Uploaded image for project: 'SonarLint for Visual Studio Code'
  1. SonarLint for Visual Studio Code
  2. SLVSCODE-121

Unable to analyze Java code on Windows with old versions of our Java analyzer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.16
    • Component/s: Connected mode
    • Labels:
      None

      Description

      VSCode encodes files URI wrongly on Windows. Those bad URIs are passed in the language server protocol.

      This results in error during the analysis of Java files, when using our Java analyzer < 5.12:

      [Info  - 12:05:15.772] Analyzing file 'file:///c%3A/Users/Julien%20HENRY/Source/Repos/sonarlint-core/core/src/main/java/org/sonarsource/sonarlint/core/StandaloneSonarLintEngineImpl.java'...
      [Error - 12:05:27.804] Analysis failed.
      [Error - 12:05:27.847] org.sonar.java.AnalysisException: SonarQube is unable to analyze file : 'c:\Users\Julien HENRY\Source\Repos\sonarlint-core\core\src\main\java\org\sonarsource\sonarlint\core\StandaloneSonarLintEngineImpl.java'
      	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:105)
      	at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:68)
      	at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:113)
      	at org.sonar.java.JavaSquid.scan(JavaSquid.java:107)
      	at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:92)
      	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
      	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
      	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:134)
      	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:152)
      	at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.analyze(StandaloneSonarLintEngineImpl.java:91)
      	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeStandalone$5(AnalysisManager.java:314)
      	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeWithTiming(AnalysisManager.java:352)
      	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeStandalone(AnalysisManager.java:314)
      	at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:246)
      	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$0(AnalysisManager.java:205)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.NullPointerException
      	at org.sonar.java.SonarComponents.fileContent(SonarComponents.java:283)
      	at org.sonar.java.ast.JavaAstScanner.getFileContent(JavaAstScanner.java:116)
      	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:89)
      	... 19 more
      

      Because they are concerned about backward compatibility, there is no plan to fix that upstream, so we will have to fix URIs on our side, like it was done here:
      https://github.com/forcedotcom/salesforcedx-vscode/pull/29/files

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jeanbaptiste.lievremont Jean-Baptiste Lievremont
              Reporter:
              julien.henry Julien Henry
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: