summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
index 2e4fc9e3a3..c66e7fd4e4 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
@@ -192,7 +192,18 @@ public class FileGroupDatabase implements GroupDatabase
_groupToUserMap.clear();
_userToGroupMap.clear();
Properties propertiesFile = new Properties();
- propertiesFile.load(new FileInputStream(groupFile));
+ FileInputStream fileInputStream = new FileInputStream(groupFile);
+ try
+ {
+ propertiesFile.load(fileInputStream);
+ }
+ finally
+ {
+ if(fileInputStream != null)
+ {
+ fileInputStream.close();
+ }
+ }
for (String propertyName : propertiesFile.stringPropertyNames())
{
@@ -233,7 +244,18 @@ public class FileGroupDatabase implements GroupDatabase
}
String comment = "Written " + new Date();
- propertiesFile.store(new FileOutputStream(groupFile), comment);
+ FileOutputStream fileOutputStream = new FileOutputStream(groupFile);
+ try
+ {
+ propertiesFile.store(fileOutputStream, comment);
+ }
+ finally
+ {
+ if(fileOutputStream != null)
+ {
+ fileOutputStream.close();
+ }
+ }
}
private void validatePropertyNameIsGroupName(String propertyName)