Unable to open files with UTF characters

My software (STIGQter) generates STIG checklist files. Some of the STIGs relate to z/OS (eg: https://www.stigviewer.com/stig/zos_racf/).

I have told SonarCloud to ignore .ckl files in its analysis, and the files get written to tests/.ckl. The invalid “/” character gets changed to the UTF " ̸" which is valid for names. Unfortunately, even with the *.ckl exclusion, SonarCloud crashes:

INFO:   Excluded sources: *libxlsxwriter*, sonar.exclusions, *.ckl
INFO:   Excluded sources for coverage: src/moc_*, src/*.h
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 37.173s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 18M/64M
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: tests/TEST_z ??OS ROSCOE for ACF2 STIG_V6R7.ckl
	at java.base/sun.nio.fs.UnixPath.encode(Unknown Source)
	at java.base/sun.nio.fs.UnixPath.<init>(Unknown Source)
	at java.base/sun.nio.fs.UnixFileSystem.getPath(Unknown Source)
	at java.base/java.nio.file.Path.resolve(Unknown Source)
	at org.sonarsource.scm.git.IncludedFilesRepository.indexFiles(IncludedFilesRepository.java:65)
	at org.sonarsource.scm.git.IncludedFilesRepository.<init>(IncludedFilesRepository.java:40)
	at org.sonarsource.scm.git.GitIgnoreCommand.init(GitIgnoreCommand.java:37)
	at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(ProjectFileIndexer.java:98)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:390)
	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:126)
	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)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
INFO: ------------------------------------------------------------------------

I ran into this while triaging my unanswered question (Error: Not Authorized (was: Successful travis build, but no results in sonarcloud)) and found that others have already reported it without an answer (Unable to execute Analysis because of special characters: java.nio.file.InvalidPathException). I’m a little concerned that once someone responds to a question, even if it isn’t a response that resolves the issue, no one comes to check to make sure that the response was valid. But that’s a separate issue.

Hello @squinky86,

By default we ignore all files that are also ignored by your .gitignore file. It seems the scanner crashed while parsing the .gitignore file. Could you share the contents of that file?