scolebourne 2004/03/17 13:09:08
Modified: collections/src/java/org/apache/commons/collections
ExtendedProperties.java
Log:
Close file created in constructor
bug 27737
Revision Changes Path
1.22 +14 -6
jakarta-commons/collections/src/java/org/apache/commons/collections/ExtendedProperties.java
Index: ExtendedProperties.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ExtendedProperties.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ExtendedProperties.java 18 Feb 2004 01:15:42 -0000 1.21
+++ ExtendedProperties.java 17 Mar 2004 21:09:08 -0000 1.22
@@ -443,8 +443,7 @@
}
/**
- * Creates and loads the extended properties from the specified
- * file.
+ * Creates and loads the extended properties from the specified file.
*
* @param file the filename to load
* @throws IOException if a file error occurs
@@ -454,8 +453,7 @@
}
/**
- * Creates and loads the extended properties from the specified
- * file.
+ * Creates and loads the extended properties from the specified file.
*
* @param file the filename to load
* @param defaultFile a second filename to load default values from
@@ -467,7 +465,17 @@
basePath = new File(file).getAbsolutePath();
basePath = basePath.substring(0, basePath.lastIndexOf(fileSeparator) + 1);
- this.load(new FileInputStream(file));
+ FileInputStream in = null;
+ try {
+ in = new FileInputStream(file);
+ this.load(in);
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException ex) {}
+ }
if (defaultFile != null) {
defaults = new ExtendedProperties(defaultFile);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]