SCM ClearCase 1.1: java.lang.IllegalStateException with symbolic link for source file

66 views
Skip to first unread message

ber...@hotmail.com

unread,
Mar 29, 2016, 8:20:45 AM3/29/16
to SonarQube
Hi,

we discovered a issue with the Clearcase SCM plug-in.



ERROR: Error during SonarQube Scanner execution

java.lang.IllegalStateException: The ClearCase annotate command [cleartool annotate -out - -fmt VERSION:%Ln@@@USER:%u@@@DATE:%Nd@@@ -nheader -f xxxxxxxxx.cpp]
failed
: cleartool: Error: Cannot perform operation for symbolic link: "xxxxxxxxxxx.cpp".


    at org.sonar.plugins.scm.clearcase.ClearCaseBlameCommand.blame(ClearCaseBlameCommand.java:70)
       at org.sonar.plugins.scm.clearcase.ClearCaseBlameCommand.blame(ClearCaseBlameCommand.java:53)
       at org.sonar.batch.scm.ScmSensor.execute(ScmSensor.java:84)
       at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
       at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
       at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
       at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:102)
       at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)
       at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
       at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
       at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:264)
       at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:259)
       at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
       at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:249)
       at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
       at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:127)
       at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
       at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
       at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
       at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
       at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
       at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
       at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
       at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:67)
       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.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
       at com.sun.proxy.$Proxy0.execute(Unknown Source)
       at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:274)
       at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
       at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:152)
       at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:133)
       at org.sonarsource.scanner.cli.Main.execute(Main.java:82)
       at org.sonarsource.scanner.cli.Main.main(Main.java:66)

Unfortunately this will stop the batch and I feel this symbolic link should be ignored by the plug-in.

Best regards
Bert

Julien HENRY

unread,
Mar 29, 2016, 11:08:37 AM3/29/16
to SonarQube, ber...@hotmail.com
Hi Bert,

Ticket created:

Thanks for the feedback!

++

Julien
...

Kevin Stevenard

unread,
Mar 31, 2016, 4:41:33 AM3/31/16
to SonarQube, ber...@hotmail.com
We got the same issue, I don't know if its the best approach, but we modified the plugin to resolve symlink and then execute annotate against the real file where clearcase will correctly report blame info. Of course this comes with the following drawback the code is taken into account many times.

Julien HENRY

unread,
Apr 1, 2016, 4:01:48 AM4/1/16
to SonarQube, ber...@hotmail.com
Hi Kevin,

That's an interesting idea even if resolving symlink may point on a file that is not managed by Clearcase (like generated code).

Would you mind submitting a Pull Request on GitHub? If it works fine we could apply the same strategy to other SCMs.

Thanks

Julien
Reply all
Reply to author
Forward
0 new messages