Bug with java sonar plugin 5.0 on sonar 6.7

51 views
Skip to first unread message

Oleg Marchuk

unread,
Dec 21, 2017, 9:49:37 AM12/21/17
to SonarQube
Hi, All

I got next exception during $ mvn sonar:sonar execution after update java sonar plugin from 4.15 to 5.0:

build   21-Dec-2017 16:37:52    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project p: SonarQube is unable to analyze file : '/A.java'
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
build  
21-Dec-2017 16:37:52            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
build  
21-Dec-2017 16:37:52            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
build  
21-Dec-2017 16:37:52            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
build  
21-Dec-2017 16:37:52            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
build  
21-Dec-2017 16:37:52            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
build  
21-Dec-2017 16:37:52            at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
build  
21-Dec-2017 16:37:52            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
build  
21-Dec-2017 16:37:52            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
build  
21-Dec-2017 16:37:52            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
build  
21-Dec-2017 16:37:52            at java.lang.reflect.Method.invoke(Method.java:498)
build  
21-Dec-2017 16:37:52            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
build  
21-Dec-2017 16:37:52            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
build  
21-Dec-2017 16:37:52            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
build  
21-Dec-2017 16:37:52            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
build  
21-Dec-2017 16:37:52    Caused by: org.apache.maven.plugin.MojoExecutionException: SonarQube is unable to analyze file : '/A.java'
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:65)
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:108)
build  
21-Dec-2017 16:37:52            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
build  
21-Dec-2017 16:37:52            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
build  
21-Dec-2017 16:37:52            ... 20 more
build  
21-Dec-2017 16:37:52    Caused by: org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '/A.java'
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:105)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:68)
build  
21-Dec-2017 16:37:52            at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:120)
build  
21-Dec-2017 16:37:52            at org.sonar.java.JavaSquid.scan(JavaSquid.java:114)
build  
21-Dec-2017 16:37:52            at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:91)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
build  
21-Dec-2017 16:37:52            at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
build  
21-Dec-2017 16:37:52            at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:281)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
build  
21-Dec-2017 16:37:52            at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
build  
21-Dec-2017 16:37:52            at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
build  
21-Dec-2017 16:37:52            at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
build  
21-Dec-2017 16:37:52            at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
build  
21-Dec-2017 16:37:52            at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
build  
21-Dec-2017 16:37:52            at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
build  
21-Dec-2017 16:37:52            at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
build  
21-Dec-2017 16:37:52            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
build  
21-Dec-2017 16:37:52            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
build  
21-Dec-2017 16:37:52            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
build  
21-Dec-2017 16:37:52            at java.lang.reflect.Method.invoke(Method.java:498)
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
build  
21-Dec-2017 16:37:52            at com.sun.proxy.$Proxy23.execute(Unknown Source)
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
build  
21-Dec-2017 16:37:52            at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:63)
build  
21-Dec-2017 16:37:52            ... 23 more
build  
21-Dec-2017 16:37:52    Caused by: java.lang.ClassCastException: org.sonar.java.resolve.Symbols$1 cannot be cast to org.sonar.java.resolve.JavaSymbol$MethodJavaSymbol
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.checks.MapComputeIfAbsentOrPresentCheck.isMethodInvocationThrowingCheckedException(MapComputeIfAbsentOrPresentCheck.java:123)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.checks.MapComputeIfAbsentOrPresentCheck.checkPreStatement(MapComputeIfAbsentOrPresentCheck.java:101)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.CheckerDispatcher.executeCheckPreStatement(CheckerDispatcher.java:57)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.ExplodedGraphWalker.visit(ExplodedGraphWalker.java:519)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.ExplodedGraphWalker.execute(ExplodedGraphWalker.java:246)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.ExplodedGraphWalker.visitMethod(ExplodedGraphWalker.java:206)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.ExplodedGraphWalker.visitMethod(ExplodedGraphWalker.java:198)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.SymbolicExecutionVisitor.execute(SymbolicExecutionVisitor.java:78)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.SymbolicExecutionVisitor.visitNode(SymbolicExecutionVisitor.java:64)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:95)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:78)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.visitors.SubscriptionVisitor.scanFile(SubscriptionVisitor.java:64)
build  
21-Dec-2017 16:37:52            at org.sonar.java.se.SymbolicExecutionVisitor.scanFile(SymbolicExecutionVisitor.java:54)
build  
21-Dec-2017 16:37:52            at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:118)
build  
21-Dec-2017 16:37:52            at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:96)
build  
21-Dec-2017 16:37:52            ... 58 more
build  
21-Dec-2017 16:37:52    [ERROR]


Regards,
Oleg

Tibor Blenessy

unread,
Dec 21, 2017, 10:14:23 AM12/21/17
to Oleg Marchuk, SonarQube
Hello Oleg,

sorry for the bad experience. Is it possible to share the file on which analysis is failing? You can sent it privately to me, if needed.  How are you running your analysis? Can you share full classpath?

If this is blocking you, you can try disable rule S3824 "Map.get and value test should be replaced with single method call" , or you can exclude the file from the analysis temporarily, or you can rollback SonarJava plugin to the previous version.

Regards
Tibor
--

Tibor Blenessy | SonarSource

SonarJava Developer

https://sonarsource.com 

Oleg Marchuk

unread,
Dec 21, 2017, 10:33:18 AM12/21/17
to Tibor Blenessy, SonarQube
Hi, Tibor

Thanks for quick reply.

I rolled back to 4.15.

Unfortunately, I cannot send you a file. Regarding running the analysis: I use maven runner. Sorry, cannot share full classpath

I cannot file any violation of this rule on this java file...

Regards,
Oleg


--
Oleg

Nicolas Peru

unread,
Dec 22, 2017, 4:03:19 AM12/22/17
to Oleg Marchuk, Tibor Blenessy, SonarQube
Hi Oleg,

Just to let you know that we are going to make a bugfix release for that issue : https://jira.sonarsource.com/browse/SONARJAVA-2599

Thanks for reporting it. 
We struggle to reproduce the case and it would be _really_ helpful to us if you could share (privately to us eventually) the part of this failing file containing the call(s) to map#put with a method invocation as the second parameter (and the signature of that invoked method).

Thanks for your help.
Cheers, 

--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages