From ef789dfa9beeacb682048b47977f21819bbb1e78 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Tue, 3 Oct 2006 21:35:06 +0000 Subject: [PATCH] Always handle refid first. Refid normally cannot be used with other attributes and some types check for this. The code is broken in a number of places - if refid is not set first. To fix this, runtimeconfigurable will now always process refid first. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@452635 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/RuntimeConfigurable.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/RuntimeConfigurable.java b/src/main/org/apache/tools/ant/RuntimeConfigurable.java index c340ca4ab..91de4cf5d 100644 --- a/src/main/org/apache/tools/ant/RuntimeConfigurable.java +++ b/src/main/org/apache/tools/ant/RuntimeConfigurable.java @@ -70,6 +70,12 @@ public class RuntimeConfigurable implements Serializable { * We could also just use SAX2 Attributes and convert to SAX1 ( DOM * attribute Nodes can also be stored in SAX2 Attributes ) * XXX under JDK 1.4 you can just use a LinkedHashMap for this purpose -jglick + * The only exception to this order is the treatment of + * refid. A number of datatypes check if refid is set + * when other attributes are set. This check will not + * work if the build script has the other attribute before + * the "refid" attribute, so now (ANT 1.7) the refid + * attribute will be processed first. */ private List/**/ attributeNames = null; @@ -185,7 +191,11 @@ public class RuntimeConfigurable implements Serializable { attributeNames = new ArrayList(); attributeMap = new HashMap(); } - attributeNames.add(name); + if (name.toLowerCase(Locale.US).equals("refid")) { + attributeNames.add(0, name); + } else { + attributeNames.add(name); + } attributeMap.put(name, value); if (name.equals("id")) { this.id = value;