From 9574f9dd640e913661eba44ce14891b0443d847c Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Sun, 27 Nov 2011 13:53:03 +0000 Subject: [PATCH] - make sure Natives extraction closes stream git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8824 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/desktop/com/jme3/system/Natives.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/src/desktop/com/jme3/system/Natives.java b/engine/src/desktop/com/jme3/system/Natives.java index e9e5c4d72..54eda3d48 100644 --- a/engine/src/desktop/com/jme3/system/Natives.java +++ b/engine/src/desktop/com/jme3/system/Natives.java @@ -139,7 +139,7 @@ public class Natives { URLConnection conn = url.openConnection(); InputStream in = conn.getInputStream(); File targetFile = new File(getExtractionDir(), fullname); - + OutputStream out = null; try { if (targetFile.exists()) { // OK, compare last modified date of this file to @@ -154,7 +154,7 @@ public class Natives { } } - OutputStream out = new FileOutputStream(targetFile); + out = new FileOutputStream(targetFile); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); @@ -176,6 +176,9 @@ public class Natives { if (load) { System.load(targetFile.getAbsolutePath()); } + if(out != null){ + out.close(); + } } logger.log(Level.FINE, "Copied {0} to {1}", new Object[]{fullname, targetFile}); }