From 0794f5cab2a48dea480630f2140167bc1398234c Mon Sep 17 00:00:00 2001 From: decebals Date: Wed, 11 Dec 2019 21:03:51 +0200 Subject: [PATCH] Resolve #355 --- pf4j/src/main/java/org/pf4j/util/FileUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java index ba9dba1..a2a1534 100644 --- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java @@ -230,7 +230,14 @@ public class FileUtils { } public static Path getPath(URI uri, String first, String... more) throws IOException { - return getFileSystem(uri).getPath(first, more); + FileSystem fileSystem = getFileSystem(uri); + Path path = fileSystem.getPath(first, more); + if ("jar".equals(uri.getScheme())) { + // it's a ZipFileSystem + fileSystem.close(); + } + + return path; } public static Path findFile(Path directoryPath, String fileName) { -- 2.39.5