ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional PropertyFile.java
Date Tue, 23 Oct 2001 14:10:29 GMT
bodewig     01/10/23 07:10:29

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional
                        PropertyFile.java
  Log:
  add some extra savety measures.
  
  Revision  Changes    Path
  1.8       +18 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  
  Index: PropertyFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PropertyFile.java	2001/10/23 11:49:45	1.7
  +++ PropertyFile.java	2001/10/23 14:10:29	1.8
  @@ -203,20 +203,30 @@
               if (m_propertyfile.exists())
               {
                   log("Updating property file: "+m_propertyfile.getAbsolutePath());
  -                FileInputStream fis = new FileInputStream(m_propertyfile);
  -                BufferedInputStream bis = new BufferedInputStream(fis);
  -                m_properties.load(bis);
  -                if (fis != null) {
  -                    fis.close();
  +                FileInputStream fis = null;
  +                try {
  +                    fis = new FileInputStream(m_propertyfile);
  +                    BufferedInputStream bis = new BufferedInputStream(fis);
  +                    m_properties.load(bis);
  +                } finally {
  +                    if (fis != null) {
  +                        fis.close();
  +                    }
                   }
               }
               else
               {
                   log("Creating new property file: "+
                       m_propertyfile.getAbsolutePath());
  -                FileOutputStream out = new FileOutputStream(m_propertyfile.getAbsolutePath());
  -                out.flush();
  -                out.close();
  +                FileOutputStream out = null;
  +                try {
  +                    out = new FileOutputStream(m_propertyfile.getAbsolutePath());
  +                    out.flush();
  +                } finally {
  +                    if (out != null) {
  +                        out.close();
  +                    }
  +                }
               }
           }
           catch(IOException ioe)
  
  
  

Mime
View raw message