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] java.lang.NullPointerException from PMD #768

Closed
parksungrin opened this issue Nov 30, 2017 · 1 comment
Closed

[apex] java.lang.NullPointerException from PMD #768

parksungrin opened this issue Nov 30, 2017 · 1 comment
Labels
a:bug PMD crashes or fails to analyse a file. in:metrics Affects the metrics framework
Milestone

Comments

@parksungrin
Copy link

Please, prefix the report title with the language it applies to within brackets, such as [java] or [apex]. If not specific to a language, you can use [core]

Rule Set:
Not sure
Description:
java.lang.NullPointerException when run PMD with below source

Code Sample demonstrating the issue:
trigger CaseAssignLevel on CaseAssignLevel__c (after delete, after insert, after undelete, after update, before delete, before insert, before update) {

if(Trigger.isBefore) {
	if(Trigger.isInsert || Trigger.isUpdate) {
		CaseAssignLevel_tr.doIsNotTrigger(Trigger.new);
	}
}



if(Trigger.isBefore && !CaseAssignLevel_tr.isNotTrigger) {
	if(Trigger.isInsert || Trigger.isUpdate) {
		CaseAssignLevel_tr.doCreateKeyValue(Trigger.new, Trigger.oldMap);	
	}
}

/*
else if(Trigger.isAfter && !CaseAssignLevel_tr.isNotTrigger) {
	if(Trigger.isInsert || Trigger.isUpdate) {
		
	}
}
*/

}

** Error detail

INFO: Deduped array ApexLexer.DFA22_transition. Found 7861612 shorts which is 14MB not including array overhead. Removed 7139464 shorts which is 13MB not counting array overhead.Took 9ms.
Exception applying rule CyclomaticComplexity on file C:\eclipse-workspace.. Dev\src\triggers\CaseAssignLevel.trigger, continuing with next rule
Nov 30, 2017 2:40:44 PM net.sourceforge.pmd.RuleSet apply
WARNING: Exception applying rule CyclomaticComplexity on file C:\eclipse-workspace\Samsung Dev\src\triggers\CaseAssignLevel.trigger, continuing with next rule
java.lang.NullPointerException
at net.sourceforge.pmd.lang.apex.ast.ApexQualifiedName.ofMethod(ApexQualifiedName.java:173)
at net.sourceforge.pmd.lang.apex.ast.ASTMethod.getQualifiedName(ASTMethod.java:51)
at net.sourceforge.pmd.lang.apex.ast.ASTMethod.getQualifiedName(ASTMethod.java:13)
at net.sourceforge.pmd.lang.metrics.AbstractMetricsFacade.computeForOperation(AbstractMetricsFacade.java:92)
at net.sourceforge.pmd.lang.apex.metrics.ApexMetrics.get(ApexMetrics.java:83)
at net.sourceforge.pmd.lang.apex.rule.design.CyclomaticComplexityRule.visit(CyclomaticComplexityRule.java:70)
at net.sourceforge.pmd.lang.apex.ast.ASTMethod.jjtAccept(ASTMethod.java:21)
at net.sourceforge.pmd.lang.apex.ast.AbstractApexNode.childrenAccept(AbstractApexNode.java:108)
at net.sourceforge.pmd.lang.apex.rule.AbstractApexRule.visit(AbstractApexRule.java:142)
at net.sourceforge.pmd.lang.apex.rule.AbstractApexRule.visit(AbstractApexRule.java:513)
at net.sourceforge.pmd.lang.apex.rule.AbstractApexRule.visitAll(AbstractApexRule.java:135)
at net.sourceforge.pmd.lang.apex.rule.AbstractApexRule.apply(AbstractApexRule.java:125)
at net.sourceforge.pmd.lang.rule.AbstractDelegateRule.apply(AbstractDelegateRule.java:279)
at net.sourceforge.pmd.RuleSet.apply(RuleSet.java:502)
at net.sourceforge.pmd.RuleSets.apply(RuleSets.java:143)
at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:181)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:95)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:50)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:75)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:23)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

oowekyala added a commit to oowekyala/pmd that referenced this issue Nov 30, 2017
oowekyala added a commit to oowekyala/pmd that referenced this issue Nov 30, 2017
oowekyala added a commit to oowekyala/pmd that referenced this issue Nov 30, 2017
@jsotuyod jsotuyod changed the title java.lang.NullPointerException from PMD [core] java.lang.NullPointerException from PMD Nov 30, 2017
@jsotuyod jsotuyod added this to the 6.0.0 milestone Nov 30, 2017
@jsotuyod jsotuyod added a:bug PMD crashes or fails to analyse a file. in:metrics Affects the metrics framework labels Nov 30, 2017
@jsotuyod
Copy link
Member

@parksungrin thanks for the report! @oowekyala is already working on this

@jsotuyod jsotuyod changed the title [core] java.lang.NullPointerException from PMD [apex] java.lang.NullPointerException from PMD Nov 30, 2017
@adangel adangel closed this as completed in 83b2e91 Dec 3, 2017
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. in:metrics Affects the metrics framework
Projects
None yet
Development

No branches or pull requests

2 participants