diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-04-08 09:05:58 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-04-08 09:05:58 -0700 |
commit | 21f8a4230b23d392975a10307fc0542575f9abe2 (patch) | |
tree | 8522bc7e4bffa55daa3d9f4b214c1e4f395f3b55 /java/src | |
parent | bug 3190 - remove Glacier2/SessionF.ice (diff) | |
download | ice-21f8a4230b23d392975a10307fc0542575f9abe2.tar.bz2 ice-21f8a4230b23d392975a10307fc0542575f9abe2.tar.xz ice-21f8a4230b23d392975a10307fc0542575f9abe2.zip |
bug 564 - Java resource leak
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/PropertiesI.java | 17 | ||||
-rw-r--r-- | java/src/IceSSL/Instance.java | 11 |
2 files changed, 27 insertions, 1 deletions
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java index 78846e25241..0c97067f201 100644 --- a/java/src/Ice/PropertiesI.java +++ b/java/src/Ice/PropertiesI.java @@ -286,9 +286,10 @@ public final class PropertiesI implements Properties public void load(String file) { + java.io.InputStream is = null; try { - java.io.InputStream is = IceInternal.Util.openResource(getClass().getClassLoader(), file); + is = IceInternal.Util.openResource(getClass().getClassLoader(), file); if(is == null) { FileException fe = new FileException(); @@ -306,6 +307,20 @@ public final class PropertiesI implements Properties fe.initCause(ex); // Exception chaining throw fe; } + finally + { + if(is != null) + { + try + { + is.close(); + } + catch(Throwable ex) + { + // Ignore. + } + } + } } public synchronized Properties diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java index 7314a839fe1..5f58c8154b2 100644 --- a/java/src/IceSSL/Instance.java +++ b/java/src/IceSSL/Instance.java @@ -258,6 +258,17 @@ class Instance e.initCause(ex); throw e; } + finally + { + try + { + in.close(); + } + catch(java.io.IOException e) + { + // Ignore. + } + } } rand.setSeed(seed); } |