Exception during scanning

Scanner raised an exception at a specific file. What can I do to finish this analysis?

  • Scanner command used when applicable (private details masked)
    sonar\sonar-scanner-4.7.0.2747-windows\bin/sonar-scanner.bat -D"sonar.organization=" -D"sonar.projectKey=" -D"sonar.sources=." -D"sonar.cfamily.build-wrapper-output=e:/build/TSS/bw-output" -D"sonar.host.url=https://sonarcloud.io" -D"sonar.verbose=true" -X

  • Languages of the repository : C++

  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

11:15:23.860 DEBUG: [pool-4-thread-7] E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp:264 expected unqualified-id
11:15:23.860 DEBUG: [pool-4-thread-7] E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp:266 expected ':' after 'default'
11:15:23.860 DEBUG: [pool-4-thread-7] E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp:266 expected expression
11:15:23.860 DEBUG: [pool-4-thread-7] E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp:266 'default' statement not in switch statement
11:15:23.860 DEBUG: [pool-4-thread-7] E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp:267 expected expression
11:15:23.960 ERROR: Exception in thread pool-4-thread-7
java.lang.IllegalStateException: E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp 266:20 266:20 S1116
        at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:965)
        at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:906)
        at com.sonar.cpp.plugin.CFamilySensor.lambda$process$14(CFamilySensor.java:798)
        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=266, lineOffset=19] should be before end pointer [line=266, lineOffset=19]
        at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
        at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:334)
        at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:275)
        at com.sonar.cpp.plugin.CFamilySensor.rangeOrLine(CFamilySensor.java:1084)
        at com.sonar.cpp.plugin.CFamilySensor.convertToSonarIssue(CFamilySensor.java:1000)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssueImpl(CFamilySensor.java:975)
        at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:963)
        ... 8 common frames omitted

Hi @Ted_Kim

The easiest way to unblock your analysis is to exclude the file that causes the failure of the analysis E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp (in your log) using sonar.exclusions parameter (relevant docs).

In addition, would it be possible for you to generate and share it with us, so we can investigate and fix the issue. To generate the reproducer for failing file file:

  • Add the reproducer option to the scanner configuration:
    sonar.cfamily.reproducer="E:\Git Repo\TSS\Components\TC.Framework.Widgets\src\ParameterControl.cpp"
  • Re-run the scanner to generate a file named sonar-cfamily.reproducer in the project folder.

If you think this file contains private information, let us know, and we’ll send you a private message that will allow you to send it privately.