Explorar o código

Fixed resource leak from never closing the JarFile.

GJ %!s(int64=13) %!d(string=hai) anos
pai
achega
bc58aff362
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/main/java/com/gmail/nossr50/spout/SpoutStuff.java

+ 3 - 1
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();