Skip to content

Commit 523991c

Browse files
committed
make sure filesystem instance is closed
1 parent 93b4a4e commit 523991c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
0 Bytes
Binary file not shown.

j-lawyer-client/src/com/jdimension/jlawyer/client/SplashThread.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,12 +902,14 @@ public void run() {
902902
rootModule.setRandomBackgroundImage(null);
903903
} else {
904904
rootModule.setBackgroundImage(null);
905+
906+
FileSystem fileSystem=null;
905907
try {
906908

907909
URI uri = Main.class.getResource("/themes/default/backgroundsrandom").toURI();
908910
Path path;
909911
if (uri.getScheme().equals("jar")) {
910-
FileSystem fileSystem = FileSystems.newFileSystem(uri, Collections.<String, Object>emptyMap());
912+
fileSystem = FileSystems.newFileSystem(uri, Collections.<String, Object>emptyMap());
911913
path = fileSystem.getPath("/themes/default/backgroundsrandom");
912914

913915
} else {
@@ -932,6 +934,14 @@ public void run() {
932934
log.error("unable to get random background image", t);
933935
rootModule.setBackgroundImage("archivefiles.jpg");
934936
rootModule.setRandomBackgroundImage(null);
937+
} finally {
938+
if(fileSystem!=null) {
939+
try {
940+
fileSystem.close();
941+
} catch (Exception ex) {
942+
log.warn("Could not close filesystem object", ex);
943+
}
944+
}
935945
}
936946

937947
}

0 commit comments

Comments
 (0)