java.lang.IllegalStateException error during SonarScanner execution

Hi,

I have a C++ project on which I ran the build-wrapper and then I ran SonarScanner. The scanner ran for a very long time but ended with a java.lang.IllegalStateException during the scan of one source file in particular.

Here is the call stack
17:25:05.633 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException:
An error occurred while analyzing the following compilation unit:
D:\cae\dev\Odyssey\Source\CaeImmersiveMassLaser\Private\MassLaser_SystemDesignatingProcessor.cpp
A file named “sonar-cfamily-reproducer.zip” has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
D:\cae\dev\Odyssey\ThirdParty\Validation\sonar-scanner-cli-4.7.0.2747-windows\bin\sonar-cfamily-reproducer.zip

    > at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:442)
    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:468)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:464)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:420)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)

I have access to a sonar-cfamily-reproducer.zip file that contains info to help improve the analyzer. I would like a description of how I debug and fix this issue. Thanks

I have since used the sonar.exclusions property of the scanner to avoid this exception

Hi @SeanCae, welcome to the community!
Could you please share with us the sonar-cfamily-reproducer.zip file in question? You can attach it to this thread, or if you prefer for privacy, you can send it to me through DM.

sonar-cfamily-reproducer.zip (2.3 MB)
Hi Fred, thanks

Hi @SeanCae,
It’s not completely clear to me at the moment whether there are multiple problems or not, but we face a first issue with the fact that the file in question is encoded as a UTF-16 file with Little Endian Byte Order Mark, which we don’t support.
Are your other files in the same encoding? If not, could you try converting it to the same encoding as the others? If all your files are in the same encoding as that, could you still try to convert this file into UTF-8 without BOM and run the analysis again? If you face the same problem after converting, could you share the newly generated reproducer that might be easier for us to analyze?
Thanks,