Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[apex] Exception applying rule UnusedLocalVariable on trigger #2554

Closed
ankushsomani09 opened this issue May 29, 2020 · 0 comments · Fixed by #2556
Closed

[apex] Exception applying rule UnusedLocalVariable on trigger #2554

ankushsomani09 opened this issue May 29, 2020 · 0 comments · Fixed by #2556
Labels
a:bug PMD crashes or fails to analyse a file. has:pr The issue is already tackled in a PR
Milestone

Comments

@ankushsomani09
Copy link

ankushsomani09 commented May 29, 2020

Executed by : ant
Apex language : trigger code
Rule name: UnusedLocalVariable subset of

<rule ref="category/apex/bestpractices.xml" />

code:
trigger leadOwnerUpdate on Lead (after update) { for(Lead Id : Trigger.new) {} }

Error:

Exception applying rule UnusedLocalVariable on file E:\writable\OneDrive\OneDrive - ANkush\Documents\sfdc\src\triggers\leadOwnerUpdate.trigger, continuing with next rule
java.lang.NullPointerException
        at net.sourceforge.pmd.lang.apex.rule.bestpractices.UnusedLocalVariableRule.visit(UnusedLocalVariableRule.java:31)
        at net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration.jjtAccept(ASTVariableDeclaration.java:22)
        at net.sourceforge.pmd.lang.apex.rule.ApexRuleChainVisitor.visit(ApexRuleChainVisitor.java:42)
        at net.sourceforge.pmd.lang.rule.AbstractRuleChainVisitor.visitAll(AbstractRuleChainVisitor.java:96)
        at net.sourceforge.pmd.RuleChain.apply(RuleChain.java:67)
        at net.sourceforge.pmd.RuleSets.apply(RuleSets.java:140)
        at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:194)
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:107)
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:89)
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51)
        at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:78)
        at net.sourceforge.pmd.processor.MonoThreadProcessor.runAnalysis(MonoThreadProcessor.java:29)
        at net.sourceforge.pmd.processor.AbstractPMDProcessor.processFiles(AbstractPMDProcessor.java:122)
        at net.sourceforge.pmd.PMD.processFiles(PMD.java:310)
        at net.sourceforge.pmd.ant.internal.PMDTaskImpl.doTask(PMDTaskImpl.java:196)
        at net.sourceforge.pmd.ant.internal.PMDTaskImpl.execute(PMDTaskImpl.java:281)
        at net.sourceforge.pmd.ant.PMDTask.execute(PMDTask.java:50)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        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.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:352)
        at org.apache.tools.ant.Target.execute(Target.java:437)
        at org.apache.tools.ant.Target.performTasks(Target.java:458)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1377)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
        at org.apache.tools.ant.Main.runBuild(Main.java:857)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
@adangel adangel changed the title Exception applying rule UnusedLocalVariable on file [apex] Exception applying rule UnusedLocalVariable on file May 29, 2020
@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label May 29, 2020
@adangel adangel changed the title [apex] Exception applying rule UnusedLocalVariable on file [apex] Exception applying rule UnusedLocalVariable on trigger May 30, 2020
@adangel adangel added this to the 6.25.0 milestone May 30, 2020
@adangel adangel added the has:pr The issue is already tackled in a PR label May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file. has:pr The issue is already tackled in a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants