SonarLint scan fails if some file is not readable due to invalid symbolic link

536 views
Skip to first unread message

sandrac...@googlemail.com

unread,
Jan 25, 2017, 5:48:28 AM1/25/17
to SonarLint
Sonarlint 2.0 scan is failing with below error when the source location being scanned has some symbolic links that points to files that are missing.

ERROR: Error executing SonarLint
java.lang.IllegalStateException: Fail to read file '/testdata/gradle/wrapper/newtest.jar' with encoding 'UTF-8'
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileMetadata.readFile(FileMetadata.java:163)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileMetadata.readMetadata(FileMetadata.java:139)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.InputFileBuilder.create(InputFileBuilder.java:49)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileIndexer.indexFile(FileIndexer.java:85)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileIndexer.indexFiles(FileIndexer.java:80)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileIndexer.index(FileIndexer.java:68)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintFileSystem.index(SonarLintFileSystem.java:39)
    at org.sonarsource.sonarlint.core.analyzer.sensor.PhaseExecutor.execute(PhaseExecutor.java:42)
    at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:143)
    at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
    at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
    at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.analyze(StandaloneGlobalContainer.java:118)
    at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.analyze(StandaloneSonarLintEngineImpl.java:93)
    at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.analyze(StandaloneSonarLintEngineImpl.java:83)
    at org.sonarlint.cli.analysis.StandaloneSonarLint.doAnalysis(StandaloneSonarLint.java:47)
    at org.sonarlint.cli.analysis.SonarLint.runAnalysis(SonarLint.java:68)
    at org.sonarlint.cli.Main.runOnce(Main.java:104)
    at org.sonarlint.cli.Main.run(Main.java:91)
    at org.sonarlint.cli.Main.execute(Main.java:167)
    at org.sonarlint.cli.Main.main(Main.java:134)
Caused by: java.io.FileNotFoundException: /testdata/gradle/wrapper/newtest.jar (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileMetadata.readFile(FileMetadata.java:158)
    ... 19 more

what is the solution other than excluding these files?  I excluded some files but its not convenient to exclude every error encountered.



Duarte Meneses

unread,
Jan 25, 2017, 7:28:14 AM1/25/17
to sandrac...@googlemail.com, SonarLint
I'm afraid there is no other solution. The general strategy is to fail fast when such errors happen so that some files are not potentially skipped.
You should either fix the link or exclude the files.

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/0e46ac04-fcbc-416a-a1f1-a8990bee153a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Duarte MENESES | SonarSource
Reply all
Reply to author
Forward
0 new messages