CompilerMessage (@NlsSafe String msgText) { // message should look like this: // 1. WARNING in /Users/andrew/git-repos/foo/src/main/java/packAction.java (at line 47) // public abstract class AbstractScmTagAction extends TaskAction implements BuildBadgeAction { // ^^^^^^^^^^^^^^^^^^^^ // But there will also be messages contributed from annotation processors that will look non-normal int dotIndex = msgText.indexOf('.'); BuildMessage.Kind kind; boolean isNormal = false; if (msgText.startsWith("Error")) { // since we are now also launching greclipse in a separate process, we may also face the errors from java kind = BuildMessage.Kind.ERROR; } else if (dotIndex > 0) { if (msgText.substring(dotIndex).startsWith(". WARNING")) { kind = BuildMessage.Kind.WARNING; isNormal = true; dotIndex += ". WARNING in ".length(); } else if (msgText.substring(dotIndex).startsWith(". ERROR")) { kind = BuildMessage.Kind.ERROR; isNormal = true; dotIndex += ". ERROR in ".length(); } else { kind = BuildMessage.Kind.INFO; } } else { kind = BuildMessage.Kind.INFO; } int firstNewline = msgText.indexOf('\n'); String firstLine = firstNewline > 0 ? msgText.substring(0, firstNewline) : msgText; String rest = firstNewline > 0 ? msgText.substring(firstNewline+1).trim() : ""; if (isNormal) { try { int parenIndex = firstLine.indexOf(" ("); String file = firstLine.substring(dotIndex, parenIndex); int line = Integer.parseInt(firstLine.substring(parenIndex + " (at line ".length(), firstLine.indexOf(')'))); int lastLineIndex = rest.lastIndexOf("\n"); return new CompilerMessage(myBuilderName, kind, rest.substring(lastLineIndex + 1), file, -1, -1, -1, line, -1); } catch (RuntimeException ignore) { } } if (msgText.trim().matches("(\\d)+ problem(s)? \\((\\d)+ (error|warning)(s)?\\)")) { return null; } return new CompilerMessage(myBuilderName, kind, msgText); } }