}else{
sonar=Sonar.create(serverUrl, userCredentials.getUsername(), PassEncoder.decodeAsString(userCredentials.getPassword()));
}
ResourceQuery query=new ResourceQuery(resource);
query.setMetrics(VIOLATIONS_DENSITY_METRICS);
Resource r = sonar.find(query);
return r.getMeasure(VIOLATIONS_DENSITY_METRICS).getValue();
} catch(ConnectionException ex) {
if(isError401(ex)){
throw new AuthorizationException(ex);
}else{