Sonar Scanner error on c++ code: java.lang.IllegalStateException CFamilySensor.java:920 on sonarqube 8.9 LTS Developer license

##Versions

  • SonarScanner for MSBuild 5.2.1
  • Run Code Analysis Task 4.20.0
  • Sonarqube 8.9 Developer
  • Java™ SE Runtime Environment (build 15+36-1562)
    Java HotSpot™ 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)
ERROR: Exception in thread pool-3-thread-1
java.lang.IllegalStateException: File.cpp 23:12 23:12 S1116
        at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:920)
        at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:859)
        at com.sonar.cpp.plugin.CFamilySensor.lambda$process$8(CFamilySensor.java:721)
        at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Start pointer [line=23, lineOffset=11] should be before end pointer [line=23, lineOffset=11]
        at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
        at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:348)
        at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:289)
        at com.sonar.cpp.plugin.CFamilySensor.rangeOrLine(CFamilySensor.java:1034)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssueImpl(CFamilySensor.java:947)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssueImpl(CFamilySensor.java:930)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:918)
        ... 8 common frames omitted

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 36:22.178s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 23M/87M
java.lang.IllegalStateException: File.cpp 23:12 23:12 S1116
        at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:920)
INFO: ------------------------------------------------------------------------
        at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:859)
        at com.sonar.cpp.plugin.CFamilySensor.lambda$process$8(CFamilySensor.java:721)
        at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Start pointer [line=23, lineOffset=11] should be before end pointer [line=23, lineOffset=11]
        at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
        at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:348)
        at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:289)
        at com.sonar.cpp.plugin.CFamilySensor.rangeOrLine(CFamilySensor.java:1034)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssueImpl(CFamilySensor.java:947)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssueImpl(CFamilySensor.java:930)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:918)
        ... 8 more
ERROR:
The SonarQube Scanner did not complete successfully
17:14:48.105  Post-processing failed. Exit code: 1

Hi @mlop3s ,

could you please share the File.cpp content and the entire sonar-scanner log output setting sonar.verbose=true property? If you cannot share publicly I can send you a private message where you can share privately.

Hi,

thanks for following up. I’ve found the problem.
The code is really old and there was a variable called “default”. I’ve renamed it to isDefault and now it works. Ticket can be closed.

Cheers,
Marco

Hi @mlop3s ,

great, thanks for the update.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.