Affects PMD Version:
6.16.0
Rule:
N/A
Description:
I am trying to run the incremental analysis with the shortFilenames option on. On first run of the code base everything works and a cache file is created with violations that exist within the code base. Upon fixing one of those violations and running PMD again, PMD is using the existing violations within the cache file and not scanning the changed file with the resolved violation. PMD then reports on the old violations that existed within the cache file.
Code Sample demonstrating the issue:
Here is the Ant target I used to recreate the issue:
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
<classpath>
<fileset dir="<path_to_pmd_lib>">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<pmd shortFilenames="true" cacheLocation="pmd.cache">
<formatter type="xml" toFile="pmd_report.xml" toConsole="true"/>
<ruleset>build/archruleset_java.xml</ruleset>
<fileset dir="${src}">
<include name="**/Application.java"/>
</fileset>
</pmd>
</target>
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
This was run through Ant. I tried replicating this with the CLI as well but I ran into a separate error:;
<error filename="src/main/java/Application.java" msg="NullPointerException: null">
<![CDATA[java.lang.NullPointerException
at net.sourceforge.pmd.cache.AbstractAnalysisCache.ruleViolationAdded(AbstractAnalysisCache.java:232)
at net.sourceforge.pmd.Report.addRuleViolation(Report.java:335)
at net.sourceforge.pmd.lang.rule.AbstractRuleViolationFactory.addViolation(AbstractRuleViolationFactory.java:37)
at net.sourceforge.pmd.lang.rule.AbstractRule.addViolation(AbstractRule.java:349)
at com.pmd.archrules.hystrix.HystrixConfigRule.visit(HystrixConfigRule.java:40)
at net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration.jjtAccept(ASTClassOrInterfaceDeclaration.java:55)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.visit(AbstractJavaRule.java:84)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.visit(AbstractJavaRule.java:280)
at net.sourceforge.pmd.lang.java.ast.ASTTypeDeclaration.jjtAccept(ASTTypeDeclaration.java:37)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.visit(AbstractJavaRule.java:84)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.visit(AbstractJavaRule.java:255)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.visitAll(AbstractJavaRule.java:39)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.apply(AbstractJavaRule.java:27)
at net.sourceforge.pmd.RuleSet.apply(RuleSet.java:499)
at net.sourceforge.pmd.RuleSets.apply(RuleSets.java:143)
at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:184)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:96)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:78)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:24)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
]]>
</error>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4