org.sonar.java.AnalysisException: SonarQube is unable to analyze file

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • sonarsource.scanner version : 3.4.0.905
  • Sonarlint pluing version :4.5.0.15320
  • SonarQube Community Plugin version : 2.8.2
  • what are you trying to achieve
  • i tried to analyze my code on local.
  • what have you tried so far to achieve this
  • First, I tried sonarlint plugin and it failed(result says there is no issue even there is) due to runtime(i realized it then). Then i installed Sonarqube Community Plugin and did the settings accordingly. When i run it, it started to give the error below:
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 : 'file.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.SonarLintUserTask.run(SonarLintUserTask.java:40)
	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$1(SonarLintJobManager.java:120)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$2(SonarLintJobManager.java:120)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
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)
	... 33 more

Then i had tried to uninstall sonarqube plugin, nothing changed. Uninstall and install the intellij again : nothing changed.

i think, sonarqube community plugin broke something in my local and i could not revert it. Could you please help on this?

Thanks in advance.

Hi,

SonarQube Community Plugin (https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin) is an unofficial plugin not developed by SonarSource. Please use its own support channel to ask questions.

I’m not sure to understand correctly this sentence, by if you need help when using SonarLint, please describe your problem. For example if you think an issue should be reported and it is not, please give us the rule key of the rule you are expecting to raise an issue. And be sure to read the SonarLint FAQ for common reasons why SonarLint is not reporting issues.

We do face the same issue with Sonarlint v4.5.0.15320. A downgrade to v4.4.0.14142 worked for us at the moment.

This error has been fixed in SonarLint for IntelliJ 4.5.1 that has been released yesterday.