if (!diagnostics.isEmpty()) {
StringBuffer buffer = new StringBuffer();
boolean foundError = false;
for (int i = 0; i < diagnostics.size(); i++) {
Diagnostic diagnostic = (Diagnostic) diagnostics.get(i);
// Add the level.
DiagnosticLevel level = diagnostic.getLevel();
if (level == DiagnosticLevel.ERROR) {
foundError = true;
}
buffer.append(level);
// Add the position in the file
buffer.append(" ");
SourceLocation location = diagnostic.getLocation();
buffer.append(location.getSourceDocumentName());
buffer.append(":(");
buffer.append(location.getSourceLineNumber());
buffer.append(",");
buffer.append(location.getSourceColumnNumber());
buffer.append(")");
// Only add the path if debug is enabled since it is internal
// but it can be pretty useful.
if (logger.isDebugEnabled()) {
buffer.append(" ");
buffer.append(diagnostic.getPath());
}
// Add the message
buffer.append(" - ");
buffer.append(diagnostic.getMessage());
buffer.append("\n");
}
if (foundError) {
if (logger.isErrorEnabled()) {