From 590a4270645d35166c9011a0d69dd228fb3e7f72 Mon Sep 17 00:00:00 2001 From: Ming Li <397177956@qq.com> Date: Mon, 17 Jul 2023 09:57:47 +0800 Subject: [PATCH] Update JuiceFileSystemImpl.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit on Windows platform, Files.isDirectory(Paths.get(jarPath)) will get InvalidPathException like java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Program Files/xxx,change to use Paths.get(location.toURI()) --- sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java b/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java index 756a57703da0..1e3c02fc8175 100644 --- a/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java +++ b/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java @@ -620,14 +620,13 @@ public static Libjfs loadLibrary() throws IOException { soTime = entry.getLastModifiedTime().toMillis(); ins = jfsJar.getInputStream(entry); } else { - String jarPath = URLDecoder.decode(location.getPath(), Charset.defaultCharset().name()); - if (Files.isDirectory(Paths.get(jarPath))) { // for debug: sdk/java/target/classes + if (Files.isDirectory(Paths.get(location.toURI()))) { // for debug: sdk/java/target/classes soTime = con.getLastModified(); ins = JuiceFileSystemImpl.class.getClassLoader().getResourceAsStream(resource); } else { JarFile jfsJar; try { - jfsJar = new JarFile(jarPath); + jfsJar = new JarFile(location.toURI().getPath()); } catch (FileNotFoundException fne) { return loadExistLib(libjfsLibraryLoader, dir, name, libFile); }