lazysodium-java icon indicating copy to clipboard operation
lazysodium-java copied to clipboard

Bundled sodium.dll cannot be loaded when path to JAR contains spaces

Open tomwetjens opened this issue 3 years ago • 1 comments

When running LazySodium on Windows, the bundled sodium.dll cannot be loaded when the path to the lazysodium JAR file contains spaces:

Native library (win32-x86-64/sodium.dll) not found in resource path (C:\Users\Tom Wetjens\.m2\repository\org\junit\platform\junit-platform-launcher\1.8.2\junit-platform-launcher-1.8.2.jar;...<cut long output>.
09:22:46.738 [main] DEBUG ResourceLoader - This is not a JAR file due to C:\Users\Tom%20Wetjens\.m2\repository\com\goterl\lazysodium-java\5.1.1\lazysodium-java-5.1.1.jar

java.nio.file.FileSystemNotFoundException
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:156)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:142)
	at java.base/java.nio.file.Path.of(Path.java:208)
	at java.base/java.nio.file.Paths.get(Paths.java:98)
	at com.goterl.resourceloader.ResourceLoader.getFileFromFileSystem(ResourceLoader.java:237)
	at com.goterl.resourceloader.ResourceLoader.copyToTempDirectory(ResourceLoader.java:88)
	at com.goterl.resourceloader.SharedLibraryLoader.load(SharedLibraryLoader.java:53)
	at com.goterl.lazysodium.utils.LibraryLoader.loadBundledLibrary(LibraryLoader.java:134)
	at com.goterl.lazysodium.utils.LibraryLoader.loadLibrary(LibraryLoader.java:95)
	at com.goterl.lazysodium.SodiumJava.<init>(SodiumJava.java:34)
	at com.goterl.lazysodium.SodiumJava.<init>(SodiumJava.java:23)

After changing the local Maven repository to a path without spaces e.g. C:\maven\repository, loading of the bundled sodium.dll works fine.

It would be nice if it works on all platforms, regardless of spaces in the path.

tomwetjens avatar Aug 04 '22 07:08 tomwetjens

Seems to be caused by https://github.com/terl/resource-loader/pull/14

tomwetjens avatar Aug 04 '22 08:08 tomwetjens