Skip to content

Commit

Permalink
on Windows platform, Paths.get(jarPath) will get InvalidPathException…
Browse files Browse the repository at this point in the history
… like "java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Program Files/xxx",change to use Paths.get(location.toURI()) (#3907)
  • Loading branch information
Ming Li authored Jul 17, 2023
1 parent d7bcecc commit 1767c51
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,19 @@ 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
URI locationUri;
try {
locationUri = location.toURI();
} catch (URISyntaxException e) {
return loadExistLib(libjfsLibraryLoader, dir, name, libFile);
}
if (Files.isDirectory(Paths.get(locationUri))) { // 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(locationUri.getPath());
} catch (FileNotFoundException fne) {
return loadExistLib(libjfsLibraryLoader, dir, name, libFile);
}
Expand Down

0 comments on commit 1767c51

Please sign in to comment.