ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant PropertyHelper.java
Date Fri, 10 Sep 2004 17:31:50 GMT
peterreilly    2004/09/10 10:31:50

  Modified:    src/main/org/apache/tools/ant PropertyHelper.java
  Log:
  use copy constructor Simplified copying of Hashtables in propertyhelper.java
  PR: 30163
  Obtained from: Jesse Glick
  
  Revision  Changes    Path
  1.17      +2 -21     ant/src/main/org/apache/tools/ant/PropertyHelper.java
  
  Index: PropertyHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/PropertyHelper.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- PropertyHelper.java	3 Sep 2004 10:43:15 -0000	1.16
  +++ PropertyHelper.java	10 Sep 2004 17:31:50 -0000	1.17
  @@ -477,19 +477,9 @@
        *         (including user properties).
        */
       public Hashtable getProperties() {
  -        Hashtable propertiesCopy = new Hashtable();
  -
  -        Enumeration e = properties.keys();
  -        while (e.hasMoreElements()) {
  -            Object name = e.nextElement();
  -            Object value = properties.get(name);
  -            propertiesCopy.put(name, value);
  -        }
  -
  +        return new Hashtable(properties);
           // There is a better way to save the context. This shouldn't
           // delegate to next, it's for backward compatibility only.
  -
  -        return propertiesCopy;
       }
   
       /**
  @@ -497,16 +487,7 @@
        * @return a hashtable containing just the user properties
        */
       public Hashtable getUserProperties() {
  -        Hashtable propertiesCopy = new Hashtable();
  -
  -        Enumeration e = userProperties.keys();
  -        while (e.hasMoreElements()) {
  -            Object name = e.nextElement();
  -            Object value = properties.get(name);
  -            propertiesCopy.put(name, value);
  -        }
  -
  -        return propertiesCopy;
  +        return new Hashtable(userProperties);
       }
   
       /**
  
  
  

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


Mime
View raw message