Element element = (Element) files.item( i );
String checkstyleName = element.getAttribute( "name" );
List<Element> errors = reportParser.getChildElements( element, "error" );
for (Element error : errors) {
RuleFailure failure = new RuleFailure();
String source = error.getAttribute( "source" );
if ( rulesService.getRuleByPluginKey( source ) == null ) {
continue;
}
failure.setRule( rulesService.getRuleByPluginKey( source ) );
failure.setFile( getFile( checkstyleName ) );
failure.setMessage( error.getAttribute( "message" ) );
String line = error.getAttribute( "line" );
if ( line != null && !"".equals( line ) ) {
failure.addParameter( "line", Double.valueOf( line ) );
}
String column = error.getAttribute( "column" );
if ( column != null && !"".equals( column ) ) {
failure.addParameter( "column", Double.valueOf( column ) );
}
String severity = error.getAttribute( "severity" );
if ( "error".equals( severity ) ) {
failure.setLevel( RuleFailureLevel.ERROR );
} else if ( "warning".equals( severity ) ) {
failure.setLevel( RuleFailureLevel.WARNING );
} else {
failure.setLevel( RuleFailureLevel.INFO );
}
failures.add( failure );
}
}