Sonar-scanner is running into an ArrayIndexOutOfBoundsException

Dear all,

sonar-scanner is running into an ArrayIndexOutOfBoundsException when processing our c-files (see below). We are running the latest scanner under Linux.

INFO: SonarQube Scanner
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-45-generic amd64
INFO: User cache: /home/holger/.sonar/cache
INFO: SonarQube server 7.5.0

Any thoughts?


18:31:04.095 INFO: [pool-4-thread-1] /home/holger/Ebee/LadepunktPlus/controller_software/src/car_comm/slac/common/slac_instr.c
18:31:07.023 INFO: ------------------------------------------------------------------------
18:31:07.023 INFO: ------------------------------------------------------------------------
18:31:07.023 INFO: Total time: 7:12.899s
18:31:07.241 INFO: Final Memory: 22M/444M
18:31:07.241 INFO: ------------------------------------------------------------------------
18:31:07.241 ERROR: Error during SonarQube Scanner execution
java.lang.ArrayIndexOutOfBoundsException: 19380
at com.sonar.cpp.plugin.CFamilySensor.lambda$execute$2(
at java.util.HashMap.forEach(
at com.sonar.cpp.plugin.CFamilySensor.execute(
at org.sonar.scanner.sensor.SensorWrapper.analyse(
at org.sonar.scanner.phases.SensorsExecutor.execute(
at org.sonar.scanner.phases.SensorsExecutor.lambda$execute$1(
at org.sonar.scanner.phases.SensorsExecutor.withGlobalStrategy(
at org.sonar.scanner.phases.SensorsExecutor.execute(
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(
at org.sonar.core.platform.ComponentContainer.startComponents(
at org.sonar.core.platform.ComponentContainer.execute(
at org.sonar.scanner.scan.ProjectScanContainer.scan(
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
at org.sonar.core.platform.ComponentContainer.startComponents(
at org.sonar.core.platform.ComponentContainer.execute(
at org.sonar.scanner.task.ScanTask.execute(
at org.sonar.scanner.task.TaskContainer.doAfterStart(
at org.sonar.core.platform.ComponentContainer.startComponents(
at org.sonar.core.platform.ComponentContainer.execute(
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(
at org.sonar.batch.bootstrapper.Batch.execute(
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
at org.sonarsource.scanner.api.EmbeddedScanner.execute(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.main(

Hi @Holger_Birkmeyer,

could you please rerun sonar-scanner adding the following property and share with me the generated sonar-cfamily.reproducer plus the slac_instr.c file?


Ciao Massimo,

  thank you for taking care of this topic. Requested info is


Cordiali saluti,


(Attachment slac_instr.c is missing)

(Attachment sonar-cfamily.reproducer is missing)

Hi @Holger_Birkmeyer,

the attachments are missing, you should rename the files to .txt before uploading them. Be aware you tried to post them here which is public. If you want to share them privately you can message me directly.

Hi @Holger_Birkmeyer,

did you modify the file after the failure? I doubt that the current file with the #if 0 is causing the stacktrace failure you reported at the beginning of the topic.

When I ran into this failure the first time, I had put the #if 0 in the file to see, whether the scanner was unhappy with some content. I have not re-run thre wrapper. I have then re-run the sonar-scanner. The exception was still there.

The run you just requested was definitely running over the slac_instr.c with the #if 0 in it…

If you want me to, I could un-modifiy the file, re-run the wrapper and re-run the scanner and post the results again?

What do you suggest?

@Holger_Birkmeyer yes please, provide sonar-scanner log with failing stacktrace and then create the reproducer without modifying the files in between.

@mpaladin I would like to send you the attachments in private, but cannot figure out, how…

The issue is due to mixed new lines style, in your file there are mixed \n \r\n and \n. The issue comes from a single \r present in the file.

To get it working you can simply normalize line endings of such file. I am not sure we are going to do something on our side. Different editors and wc they all return different line numbers for such file.

Thank you, Massimo. I will fix that asap.
Do I have to re-run the wrapper everytime I change a file?

Hi @Holger_Birkmeyer,

I would recommend you to integrate the analysis with your CI so that each time you build you also analyze the project (of course it requires a clean build).

1 Like