aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2018-07-09 20:26:08 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2018-07-09 20:26:08 +0300
commitd3e6ecda326f38a800f0c4258d1f3b5edd7badf2 (patch)
tree6b555e370f993180e770578ed3a1ebf2b3906f47 /pf4j
parent35942e586667698aa82c30b827a62c19f0a1559e (diff)
downloadpf4j-d3e6ecda326f38a800f0c4258d1f3b5edd7badf2.tar.gz
pf4j-d3e6ecda326f38a800f0c4258d1f3b5edd7badf2.zip
Fix error in getFileSystem
Diffstat (limited to 'pf4j')
-rw-r--r--pf4j/src/main/java/org/pf4j/util/FileUtils.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java
index a05367c..251af11 100644
--- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java
+++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
+import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
@@ -228,9 +229,7 @@ public class FileUtils {
}
public static Path getPath(URI uri, String first, String... more) throws IOException {
- try (FileSystem fileSystem = getFileSystem(uri)) {
- return fileSystem.getPath(first, more);
- }
+ return getFileSystem(uri).getPath(first, more);
}
public static Path findFile(Path directoryPath, String fileName) {
@@ -254,12 +253,11 @@ public class FileUtils {
}
private static FileSystem getFileSystem(URI uri) throws IOException {
- FileSystem fileSystem = FileSystems.getFileSystem(uri);
- if (fileSystem != null) {
- return fileSystem;
+ try {
+ return FileSystems.getFileSystem(uri);
+ } catch (FileSystemNotFoundException e) {
+ return FileSystems.newFileSystem(uri, Collections.<String, String>emptyMap());
}
-
- return FileSystems.newFileSystem(uri, Collections.<String, String>emptyMap());
}
}