Skip to content

dictionary: Fix dictionary path handling on Windows

Antoine Belvire requested to merge bugfix/windows-build into master

Context

Fix Windows build failure due to bad handling of dictionary path:

	org.opentest4j.AssertionFailedError: Standard error ==> expected: <> but was: <java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/C:/GitLab-Runner/builds/super7ramp/croiseur/croiseur-dictionary/croiseur-dictionary-common/build/libs/croiseur-dictionary-common-0.7.jar
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at com.gitlab.super7ramp.croiseur.dictionary.common.DictionaryPath.relativeToJar(DictionaryPath.java:84)
	at com.gitlab.super7ramp.croiseur.dictionary.common.DictionaryPath.getDefault(DictionaryPath.java:50)

Code was converting a URL to a String then creating a Path from this String. It happens to work on Linux but not on Windows. To fix this, convert URL to a URI and create a Path from this URI.

What has changed?

Main Changes

dictionary-common

Fix dictionary path.

Merge request reports