commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections ExtendedProperties.java
Date Wed, 17 Mar 2004 21:09:08 GMT
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message