sonar swift plugin exception java.nio.charset.MalformedInputException: Input length = 1

305 views
Skip to first unread message

Rishi Goel

unread,
Mar 25, 2017, 3:41:53 PM3/25/17
to SonarQube
I am testing out the sonar swift plugin for our project which uses a mix of objC and swift. I am doing the following:

1. Run unit tests
2. Use xcodebuild with -showBuildSettings to generate build-settings.txt file which contains the PROJECT_TEMP_DIR path
3. Use the commands below to get the location of coverage.profdata file and the app binary

     PROJECT_TEMP_ROOT=$(grep -m1 PROJECT_TEMP_ROOT ${BUILD_SETTINGS} | cut -d= -f2 | xargs)
     PROFDATA=$(find ${PROJECT_TEMP_ROOT}/CodeCoverage -name "Coverage.profdata")
     BINARY=$(find ${PROJECT_TEMP_ROOT}/CodeCoverage -path "*xyz.app/xyz")

4. execute xcrun llvm-cov show -instr-profile=${PROFDATA} ${BINARY} > codecoverage.report to generate the codecoverage report fie.
5. I am running build wrapper which generates a json file and give the path of the json file in the sonar-project.properties using sonar.cfamily.build-wrapper-output property
6. run sonar-scanner -e

Our unit tests have a mix of objC and swift language so the codecoverage.report file also has a mix of objC and swift info.
When I run sonar-scanner -e, I get this exception:

ERROR: Can't open coverage report file. No coverage information will be saved.

java.nio.charset.MalformedInputException: Input length = 1

at java.nio.charset.CoderResult.throwException(CoderResult.java:281) ~[na:1.8.0_111]

at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339) ~[na:1.8.0_111]

at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) ~[na:1.8.0_111]

at java.io.InputStreamReader.read(InputStreamReader.java:184) ~[na:1.8.0_111]

at java.io.BufferedReader.fill(BufferedReader.java:161) ~[na:1.8.0_111]

at java.io.BufferedReader.readLine(BufferedReader.java:324) ~[na:1.8.0_111]

at java.io.BufferedReader.readLine(BufferedReader.java:389) ~[na:1.8.0_111]

at java.nio.file.Files.readAllLines(Files.java:3205) ~[na:1.8.0_111]

at com.sonar.swift.plugin.A.A(Unknown Source) [sonar-swift-plugin-2.0.0.1127.jar:na]

at com.sonar.swift.plugin.A.A(Unknown Source) [sonar-swift-plugin-2.0.0.1127.jar:na]

at com.sonar.swift.plugin.C.A(Unknown Source) [sonar-swift-plugin-2.0.0.1127.jar:na]

at com.sonar.swift.plugin.C.execute(Unknown Source) [sonar-swift-plugin-2.0.0.1127.jar:na]

at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) [sonar-scanner-engine-shaded-5.6.6.jar:na]

at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) [sonar-scanner-api-batch988875361277342663.jar:na]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]

at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]

at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) [sonar-scanner-cli-2.8.jar:na]

at com.sun.proxy.$Proxy0.execute(Unknown Source) [na:na]

at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233) [sonar-scanner-cli-2.8.jar:na]

at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) [sonar-scanner-cli-2.8.jar:na]

at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110) [sonar-scanner-cli-2.8.jar:na]

at org.sonarsource.scanner.cli.Main.execute(Main.java:74) [sonar-scanner-cli-2.8.jar:na]

at org.sonarsource.scanner.cli.Main.main(Main.java:61) [sonar-scanner-cli-2.8.jar:na]


Rishi Goel

unread,
Mar 25, 2017, 3:42:54 PM3/25/17
to SonarQube
I tried commenting out the sonar.language property but no luck.

G. Ann Campbell

unread,
Mar 27, 2017, 2:45:27 AM3/27/17
to SonarQube
Hi,

Please contact support for commercial products.


Ann

yarru...@gmail.com

unread,
May 14, 2017, 6:56:04 AM5/14/17
to SonarQube
Hi Ann,

I'm using SonarSwift plugin by SonarSource and even i get the same error. Please advise.


16:07:13.717 INFO  - 1332/1332 source files have been analyzed
16:07:13.749 INFO  - Parse coverage report (Coverage.report)
16:07:13.765 ERROR - Can't parse coverage report file (Coverage.report). No coverage information will be saved.
java.lang.IllegalStateException: Can not parse line: 
  | _TFC4cwow16ActivityListCellCfT5styleOSC20UITableViewCellStyle15reuseIdentifierGSqSS__S0_:
	at com.sonar.swift.plugin.A.A(Unknown Source)
	at com.sonar.swift.plugin.A.A(Unknown Source)
	at com.sonar.swift.plugin.C.A(Unknown Source)
	at com.sonar.swift.plugin.C.execute(Unknown Source)
	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:182)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:76)
	at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
	at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
	at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
	at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
	at org.sonar.runner.api.Runner.execute(Runner.java:100)
	at org.sonar.runner.Main.executeTask(Main.java:70)
	at org.sonar.runner.Main.execute(Main.java:59)
	at org.sonar.runner.Main.main(Main.java:53)
16:07:13.765 INFO  - Sensor Swift Squid Sensor (done) | time=45931ms

Elena Vilchik

unread,
May 15, 2017, 3:12:13 AM5/15/17
to SonarQube, yarru...@gmail.com
Hello,

Which version of SonarSwift do you use?
This problem was fixed in SonarSwift 2.1 (ticket https://jira.sonarsource.com/browse/SONARSWIFT-287)

Elena Vilchik | SonarSource
Language Team

Ramya Yarru

unread,
May 15, 2017, 4:25:25 PM5/15/17
to Elena Vilchik, SonarQube
Hi Elena,

Thank you. SonarSwift 2.1 worked for me, I used SonarSwift 2.0 previously.

However in unit test, I have nothing displayed.

Attached screenshot, kindly advise.

Inline image 1

Elena Vilchik

unread,
May 16, 2017, 2:59:21 AM5/16/17
to Ramya Yarru, SonarQube
Hello,

For further questions please contact commercial support.

Thanks
--

Ramya Yarru

unread,
May 16, 2017, 3:42:24 AM5/16/17
to Elena Vilchik, SonarQube
Hi Elena,

Can I have their email ID please.

Thanks and Regards,
Ramya

G. Ann Campbell

unread,
May 16, 2017, 8:55:02 AM5/16/17
to SonarQube, elena....@sonarsource.com, yarru...@gmail.com
Hi Rama,

Please go back to the contacts that gave you the SonarSwift license for this.


Thx,
Ann
Reply all
Reply to author
Forward
0 new messages