Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix java.nio.file.InvalidPathException when loadLibrary on Windows platform #3907

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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