java.lang.NumberFormatException while running sonarscanar

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube: 7.9.1
    Scanner: 4.6.0.2311

  • what are you trying to achieve
    Swift Static Code Analysis & Security Review (MacOS)

  • what have you tried so far to achieve this
    We ran into an error while running the sonarscanner. Please see below,

ERROR: Error during SonarScanner execution
java.lang.NumberFormatException: Expected an int but was 6.17 at line 9 column 17
    at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1181)
    at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:257)
    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:205)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
    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)

We have tried doing multiple things but all in vain. Any help would be greatly appreciated!

Hello, I also encountered this problem. Have you solved this problem?

Hi @saioncorp ,

It seems like you are using a newer version of the build-wrapper (6.17) with an old version of the plugin. Where are you downloading the build-wrapper from? You should always download the build-wrapper from your SonarQube server to make sue you are using the correct version.

Hi Massimo, we have sonarqube enterprise. where can I found the download link for the compatible scanner? I have the same (NumberFormatException) problem

Hi @mafentakis,

you find instructions about build-wrapper download in the the documentation page: C/C++/Objective-C | SonarQube Docs, C/C++/Objective-C | SonarQube Docs for 7.9.

I have found it: https://docs.sonarqube.org/7.9/analysis/scan/sonarscanner/ (notice the version number in the link)

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