Fix for Bug 11152.
authorstechong
Fri, 02 Jul 2010 16:59:04 -0500
changeset 1574 c643300d6509
parent 1572 fc8fa1dd2c38
child 1576 ceccb3d7ade9
Fix for Bug 11152.
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 15:35:46 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java	Fri Jul 02 16:59:04 2010 -0500
@@ -16,11 +16,17 @@
 */
 package com.nokia.carbide.cdt.internal.builder.error.parsers;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import org.eclipse.cdt.core.ErrorParserManager;
 import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.core.runtime.Path;
 
 public class SBSv2ErrorParser extends CarbideBaseErrorParser {
 
+	private final Pattern msgPattern = Pattern.compile("(.*):(\\d*):(\\d*):(.*)"); //$NON-NLS-1$
+
 	public SBSv2ErrorParser() {
 	}
 
@@ -57,7 +63,7 @@
 			
 			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, severity, null, externalFilePath);
@@ -80,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;
+	}
 }