GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

New issue
Copy link
New issue
Copy link
Closed
#4300
Closed
[core] Can not set ruleset property value to empty#4279
#4300
Copy link
Assignees
adangel
Labels
a:bugPMD crashes or fails to analyse a file.
Milestone
6.54.0

Description

@hgschmie
hgschmie
opened on Jan 4, 2023
Issue body actions

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.

  1. add example above to custom ruleset.
  2. run pmd with the ruleset
  3. profit

Running PMD through: [Maven]

Activity

  1. hgschmie
    added
    a:bugPMD crashes or fails to analyse a file.
    on Jan 4, 2023
  2. adangel
    self-assigned this
    on Jan 11, 2023
  3. adangel
    added this to the 6.54.0 milestone on Jan 11, 2023
  4. adangel
    added a commit that references this issue on Jan 11, 2023

    [core] Allow empty values for rule properties

    This issue will close once commit 611cb94 is merged into the 'main' branch.
    611cb94
  5. jsotuyod
    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
  6. jsotuyod
    closed this as completedin 611cb94on Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @adangel
    adangel

Labels

a:bugPMD crashes or fails to analyse a file.

Type

No type

Projects

No projects

    Milestone

    • 6.54.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.