ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
Date Fri, 01 Feb 2002 22:46:51 GMT
sbailliez    02/02/01 14:46:51

  Modified:    src/main/org/apache/tools/ant Main.java
  Log:
  - Try to close the file rather than relying on finalization.
  
  Revision  Changes    Path
  1.55      +9 -1      jakarta-ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- Main.java	1 Feb 2002 22:27:38 -0000	1.54
  +++ Main.java	1 Feb 2002 22:46:51 -0000	1.55
  @@ -351,13 +351,21 @@
                propertyFileIndex++) {
               String filename = (String) propertyFiles.elementAt(propertyFileIndex);
               Properties props = new Properties();
  +            FileInputStream fis = null;
               try {
  -                FileInputStream fis = new FileInputStream(filename);
  +                fis = new FileInputStream(filename);
                   props.load(fis);
               }
               catch (IOException e) {
                   System.out.println("Could not load property file "
                      + filename + ": " + e.getMessage());
  +            } finally {
  +                if (fis != null){
  +                    try {
  +                        fis.close();
  +                    } catch (IOException e){
  +                }
  +              }
               }
               
               // ensure that -D properties take precedence
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message