GeezerVison is showing github.com — [core] Can not set ruleset property value to empty · Issue #4279 · pmd/pmd
[core] Can not set ruleset property value to empty #4279
Labels
a:bugPMD crashes or fails to analyse a file. Description
Affects PMD Version:
6.53.0
Description:
Docs claim "Test class name pattern to identify test classes by their fully qualified name. An empty pattern disables test class detection by name. Since PMD 6.51.0."
However, adding this to my custom pmd config:
<rule ref="category/java/errorprone.xml/TestClassWithoutTestCases">
<properties>
<property name="testClassPattern" value="" />
</properties>
</rule>
leads to
Exception Stacktrace:
Caused by: java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "this.pattern" is null
at java.util.regex.Pattern.<init> (Pattern.java:1428)
at java.util.regex.Pattern.compile (Pattern.java:1069)
at net.sourceforge.pmd.properties.ValueParserConstants$10.valueOf (ValueParserConstants.java:211)
at net.sourceforge.pmd.properties.ValueParserConstants$10.valueOf (ValueParserConstants.java:208)
at net.sourceforge.pmd.properties.GenericPropertyDescriptor.createFrom (GenericPropertyDescriptor.java:68)
at net.sourceforge.pmd.properties.AbstractSingleValueProperty.valueFrom (AbstractSingleValueProperty.java:129)
at net.sourceforge.pmd.rules.RuleFactory.setRulePropertyCapture (RuleFactory.java:307)
at net.sourceforge.pmd.rules.RuleFactory.setPropertyValues (RuleFactory.java:302)
at net.sourceforge.pmd.rules.RuleFactory.decorateRule (RuleFactory.java:126)
at net.sourceforge.pmd.RuleSetFactory.parseRuleReferenceNode (RuleSetFactory.java:726)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode (RuleSetFactory.java:505)
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode (RuleSetFactory.java:409)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet (RuleSetFactory.java:234)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet (RuleSetFactory.java:229)
at net.sourceforge.pmd.RuleSetLoader.loadFromResource (RuleSetLoader.java:253)
at net.sourceforge.pmd.RuleSetLoader.loadFromResource (RuleSetLoader.java:153)
at net.sourceforge.pmd.RuleSetLoader.loadFromResources (RuleSetLoader.java:185)
at org.apache.maven.plugins.pmd.exec.PmdExecutor.processFilesWithPMD (PmdExecutor.java:351)
at org.apache.maven.plugins.pmd.exec.PmdExecutor.run (PmdExecutor.java:248)
at org.apache.maven.plugins.pmd.exec.PmdExecutor.execute (PmdExecutor.java:83)
at org.apache.maven.plugins.pmd.PmdReport.executePmd (PmdReport.java:390)
at org.apache.maven.plugins.pmd.PmdReport.canGenerateReport (PmdReport.java:315)
Code Sample demonstrating the issue:
not needed.
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
- add example above to custom ruleset.
- run pmd with the ruleset
- profit
Running PMD through: [Maven]
Activity
added a commit that references this issue
on Jan 11, 2023This issue will close once commit 611cb94 is merged into the 'main' branch.611cb94 changed the title
[-][java] TestClassWithoutTestCases - can not set test pattern to empty[/-] [+][core] Can not set ruleset property value to empty[/+] on Jan 24, 2023
Metadata
Metadata
a:bugPMD crashes or fails to analyse a file. Development
No branches or pull requestsIssue actions