Fixed leaking file handle problem with regards to the trusted

ATS keystore file.
This commit is contained in:
Juan Carlos Luciani 2008-08-04 22:08:40 +00:00
parent 8179597cf4
commit 456d286506

View File

@ -180,6 +180,7 @@ public final class SecureTokenUtil
{ {
Map<String,X509Certificate> x509ISNCertMap; Map<String,X509Certificate> x509ISNCertMap;
InputStream inStream = null; InputStream inStream = null;
FileInputStream fis = null;
try try
{ {
// Load our crypto properties // Load our crypto properties
@ -202,7 +203,7 @@ public final class SecureTokenUtil
// Instantiate and load the keystore // Instantiate and load the keystore
KeyStore keyStore = KeyStore.getInstance(keystoreType); KeyStore keyStore = KeyStore.getInstance(keystoreType);
FileInputStream fis = new FileInputStream(keystoreFile); fis = new FileInputStream(keystoreFile);
keyStore.load(fis, keystorePass.toCharArray()); keyStore.load(fis, keystorePass.toCharArray());
// Create the Certificate issuer:sn map // Create the Certificate issuer:sn map
@ -220,9 +221,12 @@ public final class SecureTokenUtil
} }
finally finally
{ {
// Make sure that the input stream has been closed // Make sure that the streams have been closed
if (inStream != null) if (inStream != null)
inStream.close(); inStream.close();
if (fis != null)
fis.close();
} }
return x509ISNCertMap; return x509ISNCertMap;