directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r951660 - /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Date Sat, 05 Jun 2010 06:23:46 GMT
Author: felixk
Date: Sat Jun  5 06:23:46 2010
New Revision: 951660

URL: http://svn.apache.org/viewvc?rev=951660&view=rev
Log:
Avoid file descriptor leak when stream is not closed by keyStore.load

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=951660&r1=951659&r2=951660&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Sat Jun  5 06:23:46 2010
@@ -23,9 +23,12 @@ package org.apache.directory.server.ldap
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.security.KeyStore;
+import java.security.KeyStoreException;
 import java.security.KeyStoreSpi;
+import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
 import java.security.Security;
+import java.security.cert.CertificateException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -350,9 +353,19 @@ public class LdapServer extends Director
         else
         {
             keyStore = KeyStore.getInstance( KeyStore.getDefaultType() );
-            FileInputStream fis = new FileInputStream( keystoreFile );
-            
-            keyStore.load( fis, null );
+            FileInputStream fis = null;
+            try
+            {
+                fis = new FileInputStream( keystoreFile );          
+                keyStore.load( fis, null );
+            }
+            finally
+            {
+                if ( fis != null )
+                {
+                    fis.close();
+                }
+            }
         }
     }
 



Mime
View raw message