bodewig     2004/09/21 04:37:05

  Modified:    src/main/org/apache/tools/ant/taskdefs Replace.java
  Log:
  Close property file.
  
  PR: 30469
  Submitted by: Juerg Wanner <juerg at pyx dot ch>
  
  Revision  Changes    Path
  1.53      +11 -1     ant/src/main/org/apache/tools/ant/taskdefs/Replace.java
  
  Index: Replace.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Replace.java      9 Mar 2004 16:48:06 -0000       1.52
  +++ Replace.java      21 Sep 2004 11:37:05 -0000      1.53
  @@ -328,8 +328,10 @@
       public Properties getProperties(File propertyFile) throws BuildException 
{
           Properties properties = new Properties();
   
  +        FileInputStream in = null;
           try {
  -            properties.load(new FileInputStream(propertyFile));
  +            in = new FileInputStream(propertyFile);
  +            properties.load(in);
           } catch (FileNotFoundException e) {
               String message = "Property file (" + propertyFile.getPath()
                   + ") not found.";
  @@ -338,6 +340,14 @@
               String message = "Property file (" + propertyFile.getPath()
                   + ") cannot be loaded.";
               throw new BuildException(message);
  +        } finally {
  +            if (in != null) {
  +                try {
  +                    in.close();
  +                } catch (IOException e) {
  +                    // ignore
  +                }
  +            }
           }
   
           return properties;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to