From 0cb3ae74e24cfd9bac991dc46ef9e761d8bb6563 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Tue, 17 Aug 2004 18:13:50 +0000 Subject: [PATCH] fix for multiple macro instance use to fail git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276785 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 5 ++++- src/main/org/apache/tools/ant/taskdefs/MacroInstance.java | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 89dd90f6d..2750a43eb 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -65,7 +65,10 @@ Fixed bugs: * Impossible to use implicit classpath for when Ant core loader != Java application loader and Path.systemClassPath taken from ${java.class.path} - Bugzilla 30161. + Bugzilla 30161. + +* MacroInstance did not clean up nested elements correctly in the execute method, causing + multiple use of the same marco instance with nested elements to fail. Changes from Ant 1.6.1 to Ant 1.6.2 =================================== diff --git a/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java b/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java index b944a25c3..25cea48e7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java +++ b/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java @@ -48,8 +48,8 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain private MacroDef macroDef; private Map map = new HashMap(); private Map nsElements = null; - private Map presentElements = new HashMap(); - private Hashtable localProperties = new Hashtable(); + private Map presentElements; + private Hashtable localProperties; private String text = null; private String implicitTag = null; private List unknownElements = new ArrayList(); @@ -321,6 +321,7 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain * */ public void execute() { + presentElements = new HashMap(); getNsElements(); processTasks(); localProperties = new Hashtable(); @@ -379,5 +380,7 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain throw ProjectHelper.addLocationToBuildException( ex, getLocation()); } + presentElements = null; + localProperties = null; } }