Author: rgodfrey
Date: Thu Feb  2 09:17:51 2012
New Revision: 1239496

URL: http://svn.apache.org/viewvc?rev=1239496&view=rev
Log:
QPID-3789 : Fix AbstractPasswordFilePrincipalDatabase to remove possibility of 
leaked open stream

Modified:
    
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java

Modified: 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java?rev=1239496&r1=1239495&r2=1239496&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java
 (original)
+++ 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java
 Thu Feb  2 09:17:51 2012
@@ -358,19 +358,26 @@ public abstract class AbstractPasswordFi
             catch(IOException e)
             {
                 getLogger().error("Unable to create the new password file: " + 
e);
-                throw new IOException("Unable to create the new password file" 
+ e);
+                throw new IOException("Unable to create the new password 
file",e);
             }
             finally
             {
-                if (reader != null)
+
+                try
                 {
-                    reader.close();
+                    if (reader != null)
+                    {
+                        reader.close();
+                    }
                 }
-
-                if (writer != null)
+                finally
                 {
-                    writer.close();
+                    if (writer != null)
+                    {
+                        writer.close();
+                    }
                 }
+
             }
 
             swapTempFileToLive(tmp);



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to