From f16558e6390db5959d9f7b1f288b12f8e79435f5 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Fri, 10 Sep 2004 17:31:50 +0000 Subject: [PATCH] use copy constructor Simplified copying of Hashtables in propertyhelper.java PR: 30163 Obtained from: Jesse Glick git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276852 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/PropertyHelper.java | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/main/org/apache/tools/ant/PropertyHelper.java b/src/main/org/apache/tools/ant/PropertyHelper.java index 3a02295cb..d539b5df4 100644 --- a/src/main/org/apache/tools/ant/PropertyHelper.java +++ b/src/main/org/apache/tools/ant/PropertyHelper.java @@ -477,19 +477,9 @@ public class PropertyHelper { * (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 @@ public class PropertyHelper { * @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); } /**