From 456d28650645afe63c7359150c534b3ca2b44bec Mon Sep 17 00:00:00 2001 From: Juan Carlos Luciani Date: Mon, 4 Aug 2008 22:08:40 +0000 Subject: [PATCH] Fixed leaking file handle problem with regards to the trusted ATS keystore file. --- .../src/com/novell/casa/authtoksvc/SecureTokenUtil.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/SecureTokenUtil.java b/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/SecureTokenUtil.java index 6fec4245..5fdf4d61 100644 --- a/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/SecureTokenUtil.java +++ b/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/SecureTokenUtil.java @@ -180,6 +180,7 @@ public final class SecureTokenUtil { Map x509ISNCertMap; InputStream inStream = null; + FileInputStream fis = null; try { // Load our crypto properties @@ -202,7 +203,7 @@ public final class SecureTokenUtil // Instantiate and load the keystore KeyStore keyStore = KeyStore.getInstance(keystoreType); - FileInputStream fis = new FileInputStream(keystoreFile); + fis = new FileInputStream(keystoreFile); keyStore.load(fis, keystorePass.toCharArray()); // Create the Certificate issuer:sn map @@ -220,9 +221,12 @@ public final class SecureTokenUtil } finally { - // Make sure that the input stream has been closed + // Make sure that the streams have been closed if (inStream != null) inStream.close(); + + if (fis != null) + fis.close(); } return x509ISNCertMap;