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/types CommandlineJava.java PropertySet.java
Date Thu, 28 Oct 2004 09:12:03 GMT
peterreilly    2004/10/28 02:12:03

  Modified:    src/main/org/apache/tools/ant Project.java
               src/main/org/apache/tools/ant/types CommandlineJava.java
                        PropertySet.java
  Log:
  Properties.propertyNames() should be used instead of .keys():
  fix for previous fix - use getProperty() and not get()
  fix for PropertySet
  PR: 27261
  
  Revision  Changes    Path
  1.176     +3 -3      ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.175
  retrieving revision 1.176
  diff -u -r1.175 -r1.176
  --- Project.java	28 Oct 2004 08:47:26 -0000	1.175
  +++ Project.java	28 Oct 2004 09:12:02 -0000	1.176
  @@ -830,8 +830,8 @@
           Properties systemP = System.getProperties();
           Enumeration e = systemP.propertyNames();
           while (e.hasMoreElements()) {
  -            Object name = e.nextElement();
  -            String value = systemP.get(name).toString();
  +            String name = (String) e.nextElement();
  +            String value = systemP.getProperty(name);
               this.setPropertyInternal(name.toString(), value);
           }
       }
  
  
  
  1.58      +2 -2      ant/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- CommandlineJava.java	28 Oct 2004 08:47:26 -0000	1.57
  +++ CommandlineJava.java	28 Oct 2004 09:12:02 -0000	1.58
  @@ -134,8 +134,8 @@
                   sys = System.getProperties();
                   Properties p = new Properties();
                   for (Enumeration e = sys.propertyNames(); e.hasMoreElements();) {
  -                    Object o = e.nextElement();
  -                    p.put(o, sys.get(o));
  +                    String name = (String) e.nextElement();
  +                    p.put(name, sys.getProperty(name));
                   }
                   p.putAll(mergePropertySets());
                   for (Enumeration e = variables.elements(); e.hasMoreElements();) {
  
  
  
  1.16      +16 -1     ant/src/main/org/apache/tools/ant/types/PropertySet.java
  
  Index: PropertySet.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/PropertySet.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PropertySet.java	5 Aug 2004 17:14:31 -0000	1.15
  +++ PropertySet.java	28 Oct 2004 09:12:02 -0000	1.16
  @@ -174,6 +174,21 @@
       }
   
       /**
  +     * Convert the system properties to a hashtable.
  +     * Use propertynames to get the list of properties (including
  +     * default ones).
  +     */
  +    private Hashtable getAllSystemProperties() {
  +        Hashtable ret = new Hashtable();
  +        for (Enumeration e = System.getProperties().propertyNames();
  +             e.hasMoreElements();) {
  +            String name = (String) e.nextElement();
  +            ret.put(name, System.getProperties().getProperty(name));
  +        }
  +        return ret;
  +    }
  +
  +    /**
        * this is the operation to get the existing or recalculated properties.
        * @return
        */
  @@ -181,7 +196,7 @@
           Set names = null;
           Project prj = getProject();
           Hashtable props =
  -            prj == null ? System.getProperties() : prj.getProperties();
  +            prj == null ? getAllSystemProperties() : prj.getProperties();
   
           if (getDynamic() || cachedNames == null) {
               names = new HashSet();
  
  
  

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


Mime
View raw message