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

ERROR: Fail to execute PMD. Following file is ignored - NullPointerException #189

Open
vhuynh4thalesgroup opened this issue Jul 16, 2020 · 3 comments

Comments

@vhuynh4thalesgroup
Copy link

Hello,

We ve got an unexpected execution error running 7.9.2 & PMD plugin 3.2.1 that I cannot explain :

08:18:34 INFO: PMD configuration: <path_to_conffile>/.scannerwork/pmd.xml
08:18:34 ERROR: Fail to execute PMD. Following file is ignored: <path_to_sourcecode>/<classname>.java
08:18:34 net.sourceforge.pmd.PMDException: Error while processing file:<path_to_sourcecode>/<classname>.java
08:18:34 	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:102)
08:18:34 	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51)
08:18:34 	at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:101)
08:18:34 	at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:131)
08:18:34 	at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:98)
08:18:34 	at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:80)
08:18:34 	at org.sonar.plugins.pmd.PmdSensor.execute(PmdSensor.java:71)
08:18:34 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
08:18:34 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
08:18:34 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
08:18:34 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
08:18:34 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
08:18:34 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
08:18:34 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
08:18:34 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
08:18:34 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
08:18:34 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
08:18:34 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
08:18:34 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
08:18:34 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
08:18:34 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
08:18:34 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
08:18:34 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
08:18:34 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
08:18:34 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
08:18:34 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
08:18:34 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
08:18:34 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
08:18:34 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
08:18:34 	at java.lang.reflect.Method.invoke(Method.java:498)
08:18:34 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
08:18:34 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
08:18:34 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
08:18:34 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
08:18:34 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
08:18:34 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
08:18:34 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
08:18:34 Caused by: java.lang.NullPointerException: null
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.populateType(ClassTypeResolver.java:1361)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:262)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceType.jjtAccept(ASTClassOrInterfaceType.java:32)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:436)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:1156)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression.jjtAccept(ASTAllocationExpression.java:28)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:401)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:1035)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTPrimaryPrefix.jjtAccept(ASTPrimaryPrefix.java:42)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:869)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression.jjtAccept(ASTPrimaryExpression.java:22)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:296)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:729)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTExpression.jjtAccept(ASTExpression.java:34)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:226)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTVariableInitializer.jjtAccept(ASTVariableInitializer.java:22)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:216)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:602)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTVariableDeclarator.jjtAccept(ASTVariableDeclarator.java:37)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:211)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:595)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration.jjtAccept(ASTFieldDeclaration.java:56)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:56)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBodyDeclaration.jjtAccept(ASTClassOrInterfaceBodyDeclaration.java:43)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:51)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody.jjtAccept(ASTClassOrInterfaceBody.java:32)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:21)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration.jjtAccept(ASTClassOrInterfaceDeclaration.java:55)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:206)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:242)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTTypeDeclaration.jjtAccept(ASTTypeDeclaration.java:37)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:60)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:11)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:181)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:213)
08:18:34 	at net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit.jjtAccept(ASTCompilationUnit.java:41)
08:18:34 	at net.sourceforge.pmd.lang.java.typeresolution.TypeResolutionFacade.initializeWith(TypeResolutionFacade.java:18)
08:18:34 	at net.sourceforge.pmd.lang.java.AbstractJavaHandler$5.start(AbstractJavaHandler.java:109)
08:18:34 	at net.sourceforge.pmd.SourceCodeProcessor.usesTypeResolution(SourceCodeProcessor.java:153)
08:18:34 	at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:180)
08:18:34 	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:96)
08:18:34 	... 36 common frames omitted
08:18:34 
08:18:36 INFO: PMD configuration: <path_to_conffile>/.scannerwork/pmd-unit-tests.xml
08:18:36 INFO: Execute PMD 6.10.0 (done) | time=2076ms
08:18:36 INFO: Sensor PmdSensor [pmd] (done) | time=2080ms

Any idea of what might cause this issue and how to fix it ?
Does anybody already had this kind of behavior with PMD plugin ?
By the way, we are using Java 8 and the asscociated pmd sonarqube property is well set (sonar.java.source=1.8).

Thanks for helping :slight_smile:
Vincent

@vhuynh4thalesgroup
Copy link
Author

any news from this request ?

@squestc
Copy link

squestc commented Dec 30, 2020

I have met the same problem,any solution?

@jborgers
Copy link
Owner

It should work in Sonar 8.9/9.4 with sonar-pmd plugin 3.4.0. Can you try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants