* Avoid leaking FD in Natives.computeNativesHash()
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10774 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
e66abb780d
commit
610d6e47fc
@ -85,6 +85,7 @@ public final class Natives {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int computeNativesHash() {
|
private static int computeNativesHash() {
|
||||||
|
URLConnection conn = null;
|
||||||
try {
|
try {
|
||||||
String classpath = System.getProperty("java.class.path");
|
String classpath = System.getProperty("java.class.path");
|
||||||
URL url = Thread.currentThread().getContextClassLoader().getResource("com/jme3/system/Natives.class");
|
URL url = Thread.currentThread().getContextClassLoader().getResource("com/jme3/system/Natives.class");
|
||||||
@ -101,11 +102,18 @@ public final class Natives {
|
|||||||
throw new UnsupportedOperationException(ex);
|
throw new UnsupportedOperationException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
URLConnection conn = url.openConnection();
|
conn = url.openConnection();
|
||||||
int hash = classpath.hashCode() ^ (int) conn.getLastModified();
|
int hash = classpath.hashCode() ^ (int) conn.getLastModified();
|
||||||
return hash;
|
return hash;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new UnsupportedOperationException(ex);
|
throw new UnsupportedOperationException(ex);
|
||||||
|
} finally {
|
||||||
|
if (conn != null) {
|
||||||
|
try {
|
||||||
|
conn.getInputStream().close();
|
||||||
|
conn.getOutputStream().close();
|
||||||
|
} catch (IOException ex) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +241,7 @@ public final class Natives {
|
|||||||
|
|
||||||
String libraryPath = getExtractionDir().toString();
|
String libraryPath = getExtractionDir().toString();
|
||||||
if (needLWJGL) {
|
if (needLWJGL) {
|
||||||
logger.log(Level.FINE, "Extraction Directory: {0}", getExtractionDir().toString());
|
logger.log(Level.INFO, "Extraction Directory: {0}", getExtractionDir().toString());
|
||||||
|
|
||||||
// LWJGL supports this feature where
|
// LWJGL supports this feature where
|
||||||
// it can load libraries from this path.
|
// it can load libraries from this path.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user