# HG changeset patch # User stechong # Date 1278107944 18000 # Node ID c643300d6509abb8c2579ff60a5eb4762cb06f57 # Parent fc8fa1dd2c380584619f0471b88a5f20858850ed Fix for Bug 11152. diff -r fc8fa1dd2c38 -r c643300d6509 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; + } }