1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 301338: [Error Parser] Makefile error parser shows bogus external location in problems view

This commit is contained in:
Andrew Gvozdev 2010-01-30 22:07:43 +00:00
parent 916f81c0ce
commit 0315c2f844
3 changed files with 29 additions and 6 deletions

View file

@ -686,4 +686,26 @@ public class RegexErrorParserTests extends TestCase {
assertNotSame(clone1, clone2); assertNotSame(clone1, clone2);
} }
} }
/**
* Check how RegexErrorParser parses output.
*
* @throws Exception...
*/
public void testRegexErrorParserExternalLocation_bug301338() throws Exception {
RegexErrorParser regexErrorParser = new RegexErrorParser();
regexErrorParser.addPattern(new RegexErrorPattern("pattern",
"", "", "", "$0", IMarkerGenerator.SEVERITY_ERROR_RESOURCE, true));
ErrorParserManager epManager = new ErrorParserManager(fProject, markerGenerator, new String[0]);
regexErrorParser.processLine("wrong pattern", epManager);
regexErrorParser.processLine("pattern wrong", epManager);
errorList.clear();
epManager.reportProblems();
assertEquals(0, errorList.size());
}
} }

View file

@ -178,14 +178,14 @@
class="org.eclipse.cdt.core.errorparsers.RegexErrorParser" class="org.eclipse.cdt.core.errorparsers.RegexErrorParser"
id="org.eclipse.cdt.core.GmakeErrorParser" id="org.eclipse.cdt.core.GmakeErrorParser"
name="%CDTGNUMakeErrorParser.name"> name="%CDTGNUMakeErrorParser.name">
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex="make.*:.*Error.*\(ignored\)" severity="Info"/> <pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*:.*Error.*\(ignored\)" severity="Info"/>
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (\*\*\* .*)" severity="Error"/> <pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (\*\*\* .*)" severity="Error"/>
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex="make.*: \*\*\* .*" severity="Error"/> <pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: \*\*\* .*" severity="Error"/>
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex="make.*: Target (.*) not remade because of errors." severity="Error"/> <pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: Target (.*) not remade because of errors." severity="Error"/>
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): warning: (.*)" severity="Warning"/> <pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): warning: (.*)" severity="Warning"/>
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex="make.*\[.*\] Error [-]{0,1}\d*.*" severity="Warning"/> <pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*\[.*\] Error [-]{0,1}\d*.*" severity="Warning"/>
<pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (.*No such file or directory)" severity="Warning"/> <pattern description-expr="make: $3" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="(.*):(\d*): (.*No such file or directory)" severity="Warning"/>
<pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex="make.*: Circular .* dependency dropped." severity="Warning"/> <pattern description-expr="$0" eat-processed-line="true" file-expr="" line-expr="" regex=".*make.*: Circular .* dependency dropped." severity="Warning"/>
</errorparser> </errorparser>
</extension> </extension>
<extension <extension

View file

@ -277,7 +277,8 @@ public class RegexErrorPattern implements Cloneable {
*/ */
public boolean processLine(String line, ErrorParserManager eoParser) { public boolean processLine(String line, ErrorParserManager eoParser) {
Matcher matcher = getMatcher(line); Matcher matcher = getMatcher(line);
if (!matcher.find()) // pattern should cover the whole line
if (!(matcher.find() && matcher.group(0).length()==line.length()))
return false; return false;
recordError(matcher, eoParser); recordError(matcher, eoParser);