From bc58aff36286728510410467bea48c836bae0957 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 2 Jul 2012 20:44:54 -0400 Subject: [PATCH] Fixed resource leak from never closing the JarFile. --- src/main/java/com/gmail/nossr50/spout/SpoutStuff.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java b/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java index df1a6d0a9..f0a55cf6e 100644 --- a/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java +++ b/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java @@ -48,11 +48,12 @@ public class SpoutStuff { private static void writeFile(String theFileName, String theFilePath) { try { File currentFile = new File(theFilePath + theFileName); - + JarFile jar = new JarFile(mcMMO.mcmmo); JarEntry entry = jar.getJarEntry("resources/" + theFileName); InputStream is = jar.getInputStream(entry); + byte[] buf = new byte[2048]; int nbRead; @@ -64,6 +65,7 @@ public class SpoutStuff { os.flush(); os.close(); + jar.close(); } catch (FileNotFoundException e) { e.printStackTrace();