Fix NoSuchMethodError on processing errors in pmd-compat6
(cherry picked from commit f73d75d5a3)
This commit is contained in:
1 parent
655d1dc6c3
commit
6032236bb0
4 files changed
+30
-1
No files matched your search
@@ -0,0 +1,16 @@
|
||||
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" name="Exception throwing ruleset">
|
||||
<description/>
|
||||
<rule name="ExceptionThrowingRule"
|
||||
language="java"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule">
|
||||
<description>Use this rule to produce a processing error.</description>
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value><![CDATA[
|
||||
error()
|
||||
]]></value></property>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
@@ -30,8 +30,12 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<printFailingErrors>true</printFailingErrors>
|
||||
<skipPmdError>false</skipPmdError>
|
||||
<skipPmdError>true</skipPmdError> <!-- we want to capture processing errors -->
|
||||
<minimumTokens>5</minimumTokens>
|
||||
<rulesets>
|
||||
<ruleset>/rulesets/java/maven-pmd-plugin-default.xml</ruleset>
|
||||
<ruleset>${project.basedir}/exception_ruleset.xml</ruleset>
|
||||
</rulesets>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -51,3 +51,7 @@ String textReport = readFile(pmdTextReport);
|
||||
if (!textReport.contains(mainFile + ":5:\tUnusedLocalVariable")) {
|
||||
throw new RuntimeException("Expected violation has not been reported in TXT");
|
||||
}
|
||||
|
||||
if (!pmdXml.contains("<error filename=\"" + mainFile.getAbsolutePath()) || !pmdXml.contains(mainFile + "\" msg=\"PmdXPathException")) {
|
||||
throw new RuntimeException("Processing error has not been reported");
|
||||
}
|
||||
@@ -143,6 +143,11 @@ public final class Report {
|
||||
public Throwable getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
// ------------------- compat extensions --------------------
|
||||
public String getFile() {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user