Error when try to import rule set
Steps:
- Windows -> Preferences -> PMD -> Rule Configuration
- Check "Use global rule management"
- Delete all rules
- Click "Import rule set" button
- Browse and select file. (ERROR)
Log:
eclipse.buildId=4.6.3.M20170301-0400 java.version=1.8.0_121 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=es_EC Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -data file:/E:/jose/workspace_neon/ -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
org.eclipse.ui Error Tue May 30 16:34:03 COT 2017 Unhandled event loop exception
java.lang.IllegalArgumentException: Unable to exclude rules [EmptyCatchBlock]; perhaps the rule name is mispelled? at net.sourceforge.pmd.RuleSetFactory.parseRuleSetReferenceNode(RuleSetFactory.java:465) at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:405) at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:357) at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:212) at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:207) at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:168) at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:152) at net.sourceforge.pmd.eclipse.ui.preferences.RuleSetSelectionDialog.selectedRuleset(RuleSetSelectionDialog.java:430) at net.sourceforge.pmd.eclipse.ui.preferences.RuleSetSelectionDialog.updateRuleTable(RuleSetSelectionDialog.java:388) at net.sourceforge.pmd.eclipse.ui.preferences.RuleSetSelectionDialog.ruleSetChanged(RuleSetSelectionDialog.java:325) at net.sourceforge.pmd.eclipse.ui.preferences.RuleSetSelectionDialog.access$3(RuleSetSelectionDialog.java:324) at net.sourceforge.pmd.eclipse.ui.preferences.RuleSetSelectionDialog$5.widgetSelected(RuleSetSelectionDialog.java:284) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.jface.window.Window.runEventLoop(Window.java:818) at org.eclipse.jface.window.Window.open(Window.java:794) at net.sourceforge.pmd.eclipse.ui.preferences.br.RuleTableManager$7.widgetSelected(RuleTableManager.java:428) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.jface.window.Window.runEventLoop(Window.java:818) at org.eclipse.jface.window.Window.open(Window.java:794) at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:211) at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:63) at org.eclipse.jface.action.Action.runWithEvent(Action.java:473) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565) at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
@netoec84 Thanks for reporting this bug.
Could you please add the ruleset.xml here, that you tried to import? It seems, it uses "<exclude>EmptyCatchBlock</exclude>" somewhere which causes a problem. This rule is not anymore in the java-basic ruleset and should be excluded from java-empty ruleset.
@adangel Thank you for reply.
Yes, exclude is include in xml file.
No work
<rule ref="rulesets/java/basic.xml">
<exclude name="EmptyCatchBlock"/>
</rule>
Work
<rule ref="rulesets/java/basic.xml">
</rule>
Maybe, you can add a control to catch the Exception.
Thank you.