NullPointerException During SonarLint Analysis in Eclipse (cfamily)

sonarlint
sonarcfamily

(Galaxy) #1

I’m running into a NPE when running analysis on a C project with Sonarlint.

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarlint version: 4.1.0.201901311043
    TrueStudio version: 9.2.0 (Eclipse 4.6.1)
    SonarQube Developer Edition: 7.5.0.20543

  • error observed

Error during execution of SonarLint analysis
java.lang.NullPointerException
	at com.sonar.cpp.N.H.B(na:1388)
	at com.sonar.cpp.N.A.A(na:400)
	at com.sonar.cpp.plugin.R.A(na:2887)
	at com.sonar.cpp.plugin.R.execute(na:156)
	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:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

  • steps to reproduce
    Run analysis

(Massimo Paladin) #2

Hi @Galaxy,

it’s likely that you are affected by the bug described in Java exceptions for SonarLint on Eclipse (C project) .

We created a ticket on dev side CPP-2090, it is going to be fixed in sonar-cfamily analyzer version 6.1.