diff options
author | Robert Godfrey <rgodfrey@apache.org> | 2012-02-02 09:17:51 +0000 |
---|---|---|
committer | Robert Godfrey <rgodfrey@apache.org> | 2012-02-02 09:17:51 +0000 |
commit | 4069e9f9b054db800eba549d52f315a5841c0157 (patch) | |
tree | 150a79901a9e88dd91174c48da59ee5a95ac5c07 /java | |
parent | 383b58fed70714329ebc0833b5867b23bbb5cb23 (diff) | |
download | qpid-python-4069e9f9b054db800eba549d52f315a5841c0157.tar.gz |
QPID-3789 : Fix AbstractPasswordFilePrincipalDatabase to remove possibility of leaked open stream
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1239496 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java index 9277b80b99..7088fae50c 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/AbstractPasswordFilePrincipalDatabase.java +++ b/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); |