pmd / pmd/pmd-eclipse-plugin

Gracefully handle missing rules due to wrong PMD version

Open
#62 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
99
Forks
42
Avg merge
20h 19m
Merged PRs (30d)
19

Description

When using m2e + m2e-code-quality + pmd-eclipse-plugin, configuration of the project might fail, if the PMD versions don't match. E.g. the PMD version in the project might be newer than the one used by eclipse.

Example stack trace:

Sep. 27, 2018 2:01:59 NACHM. net.sourceforge.pmd.rules.RuleFactory buildRule
SCHWERWIEGEND: Error instantiating a rule
java.lang.ClassNotFoundException: net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule cannot be found by net.sourceforge.pmd.eclipse.plugin_4.0.17.v20180801-1551
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:508)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	at net.sourceforge.pmd.rules.RuleBuilder.build(RuleBuilder.java:179)
	at net.sourceforge.pmd.rules.RuleFactory.buildRule(RuleFactory.java:189)
	at net.sourceforge.pmd.RuleSetFactory.parseSingleRuleNode(RuleSetFactory.java:562)
	at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:461)
	at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:367)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:214)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:209)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:170)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:154)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.loadRuleSetFromProject(ProjectPropertiesManagerImpl.java:175)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.fillProjectProperties(ProjectPropertiesManagerImpl.java:246)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.loadProjectProperties(ProjectPropertiesManagerImpl.java:116)
	at net.sourceforge.pmd.eclipse.plugin.PMDPlugin.loadProjectProperties(PMDPlugin.java:510)
	at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.getProjectProperties(ReviewCodeCmd.java:442)
	at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.processResourceDelta(ReviewCodeCmd.java:616)
	at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.execute(ReviewCodeCmd.java:219)
	at net.sourceforge.pmd.eclipse.runtime.cmd.JobCommandProcessor$1.run(JobCommandProcessor.java:93)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)

Other example:
grafik

An internal error occurred during: "Updating Maven Project".
Unable to find referenced rule IdenticalCatchBranches; perhaps the rule name is mispelled?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with m2e, m2e-code-quality, and mismatched PMD versions, then trace the stack from RuleFactory and RuleBuilder through RuleSetFactory to ProjectPropertiesManagerImpl. Determine the expected behavior for missing rules and verify that project configuration reports or handles the mismatch without the shown internal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.