# HG changeset patch
# User stechong
# Date 1278107906 18000
# Node ID 660c89efde83a36257e67ef36d5ae6e8b59ae8bf
# Parent b1641b8ccefba7d3181fb3ad5624313e446922f5
Fix for Bug 11152.
diff -r b1641b8ccefb -r 660c89efde83 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java Fri Jul 02 09:32:59 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java Fri Jul 02 16:58:26 2010 -0500
@@ -21,12 +21,11 @@
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.core.runtime.Path;
public class SBSv2ErrorParser extends CarbideBaseErrorParser {
- private static final Pattern warningPattern = Pattern.compile("(.*)"); //$NON-NLS-1$
- private static final Pattern errorPattern = Pattern.compile("(.*)"); //$NON-NLS-1$
- private static final Pattern infoPattern = Pattern.compile("(.*)"); //$NON-NLS-1$
+ private final Pattern msgPattern = Pattern.compile("(.*):(\\d*):(\\d*):(.*)"); //$NON-NLS-1$
public SBSv2ErrorParser() {
}
@@ -35,51 +34,50 @@
initialise();
- Matcher matcher = infoPattern.matcher(line);
- if (matcher.matches()) {
+ if (line.startsWith(""))
return true; // just ignore info messages
- }
- matcher = warningPattern.matcher(line);
- if (matcher.matches()) {
+
+ // full message detected
+ if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_ERROR_BUILD))
+ return true;
+ if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_WARNING))
+ return true;
+
+ // some messages are split across multiple lines, so for now, at least show the first line (where , etc. are)
+ if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_ERROR_BUILD))
+ return true;
+ if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_WARNING))
+ return true;
+
+ return false;
+ }
+
+ protected boolean findMessage(ErrorParserManager errorParserManager, String line,
+ String startStrip, String endStrip, int severity) {
+ int idx = line.indexOf(startStrip);
+ int endIdx = line.indexOf(endStrip);
+ if (idx >= 0 && endIdx >= 0) {
// strip the tags
- String text = line.substring("".length(), line.length() - "".length()); //$NON-NLS-1$ //$NON-NLS-2$
+ int descStart = idx + startStrip.length();
+ int descEnd = line.length() - endStrip.length();
+
+ String text = line.substring(descStart, descEnd);
if (setFirstColon(text)) {
- if (setFileNameAndLineNumber(text)) {
+ if (setFileNameAndLineNumber(text) || setSBSv2FileNameAndLineNumber(text)) {
setFile(errorParserManager);
setDescription(text);
- errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_WARNING, null, externalFilePath);
+ errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, severity, null, externalFilePath);
return true;
}
}
msgFileName = ""; //$NON-NLS-1$
- msgDescription = matcher.group(1);
+ msgDescription = text;
setFile(errorParserManager);
- errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_WARNING, null, externalFilePath);
+ errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, severity, null, externalFilePath);
return true;
}
-
- matcher = errorPattern.matcher(line);
- if (matcher.matches()) {
- // strip the tags
- String text = line.substring("".length(), line.length() - "".length()); //$NON-NLS-1$ //$NON-NLS-2$
- if (setFirstColon(text)) {
- if (setFileNameAndLineNumber(text)) {
- setFile(errorParserManager);
- setDescription(text);
- errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_ERROR_BUILD, null, externalFilePath);
- return true;
- }
- }
- msgFileName = ""; //$NON-NLS-1$
- msgDescription = matcher.group(1);
- setFile(errorParserManager);
- errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_ERROR_BUILD, null, externalFilePath);
- return true;
- }
-
return false;
}
-
public void setDescription(String line) {
// Get the iDescription
msgDescription = line.substring(msgFirstColon + 1).trim();
@@ -88,4 +86,21 @@
}
}
+ protected boolean setSBSv2FileNameAndLineNumber(String line) {
+ // Get the first Substring, which must be in the form of
+ // "fileName:line number:postion"
+ String firstSubstr = line.substring(msgFirstColon + 1).trim();
+ if (firstSubstr != null) {
+ Matcher matcher = msgPattern.matcher(firstSubstr);
+ if (matcher.matches()) {
+ msgFileName = matcher.group(1);
+ if (!Path.EMPTY.isValidPath(msgFileName)) {
+ return false;
+ }
+ msgLineNumber = Integer.parseInt(matcher.group(2));
+ return true;
+ }
+ }
+ return false;
+ }
}