summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2012-02-02 09:17:51 +0000
committerRobert Godfrey <rgodfrey@apache.org>2012-02-02 09:17:51 +0000
commite3614e3deadf34c125b81a6f341014e3d69364c0 (patch)
tree0b7a942749837988f1600183ebc30035a0d9961b
parent0dcfedb9a055a5ec9175a13cdce8667104cd799a (diff)
downloadqpid-python-e3614e3deadf34c125b81a6f341014e3d69364c0.tar.gz
QPID-3789 : Fix AbstractPasswordFilePrincipalDatabase to remove possibility of leaked open stream
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1239496 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java
index 9277b80b99..7088fae50c 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java
@@ -358,19 +358,26 @@ public abstract class AbstractPasswordFilePrincipalDatabase<U extends PasswordPr
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);