From dd5ec3705517257e15f09d821480399a22f884a1 Mon Sep 17 00:00:00 2001 From: extendedclip Date: Sun, 22 Jul 2018 16:52:36 -0400 Subject: [PATCH] try with resources cuz haters --- src/main/java/me/clip/placeholderapi/util/FileUtil.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/util/FileUtil.java b/src/main/java/me/clip/placeholderapi/util/FileUtil.java index fae1731..743a02d 100644 --- a/src/main/java/me/clip/placeholderapi/util/FileUtil.java +++ b/src/main/java/me/clip/placeholderapi/util/FileUtil.java @@ -67,9 +67,7 @@ public class FileUtil { if (list == null) { list = new ArrayList<>(); } - try { - URLClassLoader cl = new URLClassLoader(new URL[]{jar}, clazz.getClassLoader()); - JarInputStream jis = new JarInputStream(jar.openStream()); + try (URLClassLoader cl = new URLClassLoader(new URL[]{jar}, clazz.getClassLoader()); JarInputStream jis = new JarInputStream(jar.openStream())) { while (true) { JarEntry j = jis.getNextJarEntry(); if (j == null) { @@ -88,8 +86,6 @@ public class FileUtil { } } } - cl.close(); - jis.close(); } catch (Throwable t) { } return list;