Uploaded image for project: 'SonarLint For IntelliJ'
  1. SonarLint For IntelliJ
  2. SLI-379

Unable to analyze Java files in connected mode with SonarJava < 5.12

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5
    • Fix Version/s: 4.5.1
    • Component/s: Connected Mode
    • Labels:
      None

      Description

      Due to a change in SonarLint Core for SLCORE-261 (https://github.com/SonarSource/sonarlint-core/commit/d7d24c048980d53e043c085941158c159ca2f663#diff-729d7c6647db4d46fc2739daa8197abaR111) a hidden bug in SonarLint IntelliJ way of computing file URIs on Windows is leading to an error during the analysis.

      Analysing 'ClirrSensor.java'...
      Starting analysis with configuration:
      [
        projectKey: org.sonarsource.clirr:sonar-clirr-plugin
        baseDir: C:\Prog\Projects\sonar-clirr
        inputFiles: [
          file://C:/Prog/Projects/sonar-clirr/src/main/java/org/sonar/plugins/clirr/ClirrSensor.java (UTF-8)
        ]
      ]
      
      Available languages:
        * Java => "java"
      Start analysis
      Declared extensions of language Java were converted to java: **/*.java,**/*.jav
      Index files
      Language of file 'file://C:/Prog/Projects/sonar-clirr/src/main/java/org/sonar/plugins/clirr/ClirrSensor.java' is detected to be 'java'
      1 file indexed
      Quality profiles:
        * java: 'Sonar way' (324 rules)
      Execute Sensor: JavaSquidSensor
      Configured Java source version (sonar.java.source): 7
      JavaClasspath initialization
      JavaClasspath initialization (done) | time=34ms
      JavaTestClasspath initialization
      JavaTestClasspath initialization (done) | time=23ms
      [...]
      -----
      Java Main Files AST scan
      1 source files to be analyzed
      Error running SonarLint analysis
      org.sonar.java.AnalysisException: SonarQube is unable to analyze file : 'C:\Prog\Projects\sonar-clirr\src\main\java\org\sonar\plugins\clirr\ClirrSensor.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:116)
      	at org.sonar.java.JavaSquid.scan(JavaSquid.java:110)
      	at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:93)
      	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.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:75)
      	at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:81)
      	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.intellij.core.ConnectedSonarLintFacade.analyze(ConnectedSonarLintFacade.java:74)
      	at org.sonarlint.intellij.core.SonarLintFacade.startAnalysis(SonarLintFacade.java:63)
      	at org.sonarlint.intellij.analysis.SonarLintAnalyzer.analyzeModule(SonarLintAnalyzer.java:97)
      	at org.sonarlint.intellij.analysis.SonarLintTask.analyze(SonarLintTask.java:187)
      	at org.sonarlint.intellij.analysis.SonarLintTask.run(SonarLintTask.java:109)
      	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$1(SonarLintJobManager.java:120)
      	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
      	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
      	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
      	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
      	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
      	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$2(SonarLintJobManager.java:120)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	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:298)
      	at org.sonar.java.ast.JavaAstScanner.getFileContent(JavaAstScanner.java:116)
      	at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:89)
      	... 32 more
      

      You can see in the log that the file URI is not a valid file URI:
      file://C:/Prog/Projects/sonar-clirr/src/main/java/org/sonar/plugins/clirr/ClirrSensor.java
      while it should have 3 forward slashes:
      file:///C:/Prog/Projects/sonar-clirr/src/main/java/org/sonar/plugins/clirr/ClirrSensor.java

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julien.henry Julien Henry
              Reporter:
              julien.henry Julien Henry
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: