servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1338031 - in /servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login: CertificatesLoginModule.java PropertiesLoginModule.java
Date Mon, 14 May 2012 03:59:38 GMT
Author: ffang
Date: Mon May 14 03:59:38 2012
New Revision: 1338031

URL: http://svn.apache.org/viewvc?rev=1338031&view=rev
Log:
[SM-2153]PropertiesLoginModule always leave file handler open

Modified:
    servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java
    servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java

Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java?rev=1338031&r1=1338030&r2=1338031&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java
(original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java
Mon May 14 03:59:38 2012
@@ -18,6 +18,7 @@ package org.apache.servicemix.jbi.securi
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
 import java.util.Enumeration;
@@ -84,16 +85,37 @@ public class CertificatesLoginModule imp
 
     public boolean login() throws LoginException {
         File f = new File(baseDir, usersFile);
+        InputStream fis = null;
         try {
-            users.load(new java.io.FileInputStream(f));
+            fis = new java.io.FileInputStream(f);
+            users.load(fis);
         } catch (IOException ioe) {
             throw new LoginException("Unable to load user properties file " + f);
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                    fis = null;
+                } catch (IOException e) {
+                    throw new LoginException("Unable to close user properties file " + f);
+                }
+            }
         }
         f = new File(baseDir, groupsFile);
         try {
-            groups.load(new java.io.FileInputStream(f));
+            fis = new java.io.FileInputStream(f);
+            groups.load(fis);
         } catch (IOException ioe) {
             throw new LoginException("Unable to load group properties file " + f);
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                    fis = null;
+                } catch (IOException e) {
+                    throw new LoginException("Unable to close group properties file " + f);
+                }
+            }
         }
 
         Callback[] callbacks = new Callback[1];

Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java?rev=1338031&r1=1338030&r2=1338031&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java
(original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java
Mon May 14 03:59:38 2012
@@ -18,6 +18,7 @@ package org.apache.servicemix.jbi.securi
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Map;
@@ -82,16 +83,37 @@ public class PropertiesLoginModule imple
 
     public boolean login() throws LoginException {
         File f = new File(baseDir, usersFile);
+        InputStream fis = null;
         try {
-            users.load(new java.io.FileInputStream(f));
+            fis = new java.io.FileInputStream(f);
+            users.load(fis);
         } catch (IOException ioe) {
             throw new LoginException("Unable to load user properties file " + f);
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                    fis = null;
+                } catch (IOException e) {
+                    throw new LoginException("Unable to close user properties file " + f);
+                }
+            }
         }
         f = new File(baseDir, groupsFile);
         try {
-            groups.load(new java.io.FileInputStream(f));
+            fis = new java.io.FileInputStream(f);
+            groups.load(fis);
         } catch (IOException ioe) {
             throw new LoginException("Unable to load group properties file " + f);
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                    fis = null;
+                } catch (IOException e) {
+                    throw new LoginException("Unable to close group properties file " + f);
+                }
+            }
         }
 
         Callback[] callbacks = new Callback[2];



Mime
View raw message