fix for previous fix - use getProperty() and not get() fix for PropertySet PR: 27261 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276971 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -830,8 +830,8 @@ public class Project { | |||||
| Properties systemP = System.getProperties(); | Properties systemP = System.getProperties(); | ||||
| Enumeration e = systemP.propertyNames(); | Enumeration e = systemP.propertyNames(); | ||||
| while (e.hasMoreElements()) { | 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); | this.setPropertyInternal(name.toString(), value); | ||||
| } | } | ||||
| } | } | ||||
| @@ -134,8 +134,8 @@ public class CommandlineJava implements Cloneable { | |||||
| sys = System.getProperties(); | sys = System.getProperties(); | ||||
| Properties p = new Properties(); | Properties p = new Properties(); | ||||
| for (Enumeration e = sys.propertyNames(); e.hasMoreElements();) { | 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()); | p.putAll(mergePropertySets()); | ||||
| for (Enumeration e = variables.elements(); e.hasMoreElements();) { | for (Enumeration e = variables.elements(); e.hasMoreElements();) { | ||||
| @@ -173,6 +173,21 @@ public class PropertySet extends DataType { | |||||
| return isReference() ? getRef()._mapper : _mapper; | return isReference() ? getRef()._mapper : _mapper; | ||||
| } | } | ||||
| /** | |||||
| * 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. | * this is the operation to get the existing or recalculated properties. | ||||
| * @return | * @return | ||||
| @@ -181,7 +196,7 @@ public class PropertySet extends DataType { | |||||
| Set names = null; | Set names = null; | ||||
| Project prj = getProject(); | Project prj = getProject(); | ||||
| Hashtable props = | Hashtable props = | ||||
| prj == null ? System.getProperties() : prj.getProperties(); | |||||
| prj == null ? getAllSystemProperties() : prj.getProperties(); | |||||
| if (getDynamic() || cachedNames == null) { | if (getDynamic() || cachedNames == null) { | ||||
| names = new HashSet(); | names = new HashSet(); | ||||