SonarLint "Exception" – 'Forced to init a physical file'

sonarlint

(Paul Wagland) #1

Hi all,

First up, words of praise for a great product in SonarQube and SonarLint. It looks like a really useful combination!

SonarLint used to work OK for me, as in once I got the connection issue resolved, it was connecting to the server, reading the rules from the server, and processing files. However, recently it has started to fail processing files, when looking into this trying to determine why it isn’t giving any results anymore, I found my logs littered with:

Forced to init a physical file

java.lang.Exception
at org.sonarlint.eclipse.core.internal.jobs.EclipseInputFile.initFromFS(EclipseInputFile.java:70)
at org.sonarlint.eclipse.core.internal.jobs.EclipseInputFile.getPath(EclipseInputFile.java:64)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile.path(SonarLintInputFile.java:114)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintInputFile.file(SonarLintInputFile.java:105)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at org.sonar.plugins.java.JavaSquidSensor.toFile(JavaSquidSensor.java:105)
at org.sonar.plugins.java.JavaSquidSensor.getTestFiles(JavaSquidSensor.java:101)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:92)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:72)
at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:132)
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.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:75)
at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:82)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:152)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:344)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:334)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:149)
at org.sonarlint.eclipse.core.internal.server.Server.runAnalysis(Server.java:312)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeConnectedProjectJob.runAnalysis(AnalyzeConnectedProjectJob.java:67)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeConnectedProjectJob.runAnalysis(AnalyzeConnectedProjectJob.java:1)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.run(AbstractAnalyzeProjectJob.java:397)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.runAnalysisAndUpdateMarkers(AbstractAnalyzeProjectJob.java:205)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.doRun(AbstractAnalyzeProjectJob.java:167)
at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.runInWorkspace(AbstractSonarProjectJob.java:44)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Turns out that this is just debugging, however it is really had to see that from the console output. I humble suggest that the Exception is given a message, something like "The following stracktrace is for debug purposes.". Even better, create a newExceptionclass with the nameDebugStacktraceException`, with an error message… that would make it very clear that to users trying to diagnose problems that this isn’t the problem that they are looking for.

Cheers,
Paul


(Duarte Meneses) #2

Hi Paul,
thanks for the feedback. I agree that the stack trace can be misleading.

To understand why it’s there in the first place, could you let us know what is the version of the Java analyzer that you are running?


(Julien Henry) #3

I will remove the exception:
https://jira.sonarsource.com/browse/SLE-301