You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@apache.org on 2005/03/10 00:38:22 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional EchoProperties.java

stevel      2005/03/09 15:38:22

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional
                        EchoProperties.java
  Log:
  bit of cleanup here
  
  Revision  Changes    Path
  1.29      +8 -15     ant/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
  
  Index: EchoProperties.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- EchoProperties.java	22 Nov 2004 09:23:31 -0000	1.28
  +++ EchoProperties.java	9 Mar 2005 23:38:22 -0000	1.29
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2002-2004 The Apache Software Foundation
  + * Copyright  2002-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -42,6 +42,7 @@
   import org.apache.tools.ant.types.PropertySet;
   import org.apache.tools.ant.util.CollectionUtils;
   import org.apache.tools.ant.util.DOMElementWriter;
  +import org.apache.tools.ant.util.FileUtils;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -208,7 +209,7 @@
           use Ant's properties */
           if (inFile == null && propertySets.size() == 0) {
               // add ant properties
  -            CollectionUtils.putAll(allProps, getProject().getProperties());
  +            allProps.putAll(getProject().getProperties());
           } else if (inFile != null) {
               if (inFile.exists() && inFile.isDirectory()) {
                   String message = "srcfile is a directory!";
  @@ -235,7 +236,7 @@
                   in = new FileInputStream(inFile);
                   Properties props = new Properties();
                   props.load(in);
  -                CollectionUtils.putAll(allProps, props);
  +                allProps.putAll(props);
               } catch (FileNotFoundException fnfe) {
                   String message =
                       "Could not find file " + inFile.getAbsolutePath();
  @@ -255,20 +256,14 @@
                   }
                   return;
               } finally {
  -                try {
  -                    if (null != in) {
  -                        in.close();
  -                    }
  -                } catch (IOException ioe) {
  -                    //ignore
  -                }
  +                FileUtils.close(in);
               }
           }
   
           Enumeration e = propertySets.elements();
           while (e.hasMoreElements()) {
               PropertySet ps = (PropertySet) e.nextElement();
  -            CollectionUtils.putAll(allProps, ps.getProperties());
  +            allProps.putAll(ps.getProperties());
           }
   
           OutputStream os = null;
  @@ -353,7 +348,7 @@
           public String key;
           public String value;
   
  -        public Tuple(String key, String value) {
  +        private Tuple(String key, String value) {
               this.key = key;
               this.value = value;
           }
  @@ -412,9 +407,7 @@
           } catch (IOException ioe) {
               throw new BuildException("Unable to write XML file", ioe);
           } finally {
  -            if (wri != null) {
  -                wri.close();
  -            }
  +            FileUtils.close(wri);
           }
       }
   
  
  
  

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