- make sure Natives extraction closes stream
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8824 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
e285caae6d
commit
9574f9dd64
@ -139,7 +139,7 @@ public class Natives {
|
|||||||
URLConnection conn = url.openConnection();
|
URLConnection conn = url.openConnection();
|
||||||
InputStream in = conn.getInputStream();
|
InputStream in = conn.getInputStream();
|
||||||
File targetFile = new File(getExtractionDir(), fullname);
|
File targetFile = new File(getExtractionDir(), fullname);
|
||||||
|
OutputStream out = null;
|
||||||
try {
|
try {
|
||||||
if (targetFile.exists()) {
|
if (targetFile.exists()) {
|
||||||
// OK, compare last modified date of this file to
|
// 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;
|
int len;
|
||||||
while ((len = in.read(buf)) > 0) {
|
while ((len = in.read(buf)) > 0) {
|
||||||
out.write(buf, 0, len);
|
out.write(buf, 0, len);
|
||||||
@ -176,6 +176,9 @@ public class Natives {
|
|||||||
if (load) {
|
if (load) {
|
||||||
System.load(targetFile.getAbsolutePath());
|
System.load(targetFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
if(out != null){
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.log(Level.FINE, "Copied {0} to {1}", new Object[]{fullname, targetFile});
|
logger.log(Level.FINE, "Copied {0} to {1}", new Object[]{fullname, targetFile});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user