Browse Source

Bugzilla 40621: fix ordering of add and addconfigured

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@450605 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
d2cdd21fe5
2 changed files with 7 additions and 33 deletions
  1. +3
    -32
      src/main/org/apache/tools/ant/RuntimeConfigurable.java
  2. +4
    -1
      src/main/org/apache/tools/ant/UnknownElement.java

+ 3
- 32
src/main/org/apache/tools/ant/RuntimeConfigurable.java View File

@@ -350,12 +350,11 @@ public class RuntimeConfigurable implements Serializable {
* @param p The project containing the wrapped element. * @param p The project containing the wrapped element.
* Must not be <code>null</code>. * Must not be <code>null</code>.
* *
* @param configureChildren Whether to configure child elements as
* well. if true, child elements will be configured after the
* wrapped element.
* @param configureChildren ignored.

* *
* @exception BuildException if the configuration fails, for instance due * @exception BuildException if the configuration fails, for instance due
* to invalid attributes or children, or text being added to
* to invalid attributes , or text being added to
* an element which doesn't accept it. * an element which doesn't accept it.
*/ */
public synchronized void maybeConfigure(Project p, boolean configureChildren) public synchronized void maybeConfigure(Project p, boolean configureChildren)
@@ -408,34 +407,6 @@ public class RuntimeConfigurable implements Serializable {
ProjectHelper.addText(p, wrappedObject, characters.substring(0)); ProjectHelper.addText(p, wrappedObject, characters.substring(0));
} }


Enumeration e = getChildren();
while (e.hasMoreElements()) {
RuntimeConfigurable child = (RuntimeConfigurable) e.nextElement();
synchronized (child) {
if (child.wrappedObject instanceof Task) {
Task childTask = (Task) child.wrappedObject;
childTask.setRuntimeConfigurableWrapper(child);
}
if ((child.creator != null) && configureChildren) {
child.maybeConfigure(p);
child.creator.store();
continue;
}
/*
* backwards compatibility - element names of nested
* elements have been all lower-case in Ant, except for
* tasks in TaskContainers.
*
* For TaskContainers, we simply skip configuration here.
*/
String tag = child.getElementTag().toLowerCase(Locale.US);
if (configureChildren && ih.supportsNestedElement(tag)) {
child.maybeConfigure(p);
ProjectHelper.storeChild(p, target, child.wrappedObject, tag);
}
}
}

if (id != null) { if (id != null) {
p.addReference(id, wrappedObject); p.addReference(id, wrappedObject);
} }


+ 4
- 1
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -183,7 +183,6 @@ public class UnknownElement extends Task {
} }
} }


handleChildren(realThing, getWrapper());


// configure attributes of the object and it's children. If it is // configure attributes of the object and it's children. If it is
// a task container, defer the configuration till the task container // a task container, defer the configuration till the task container
@@ -194,6 +193,8 @@ public class UnknownElement extends Task {
} else { } else {
getWrapper().maybeConfigure(getProject()); getWrapper().maybeConfigure(getProject());
} }

handleChildren(realThing, getWrapper());
} }


/** /**
@@ -555,7 +556,9 @@ public class UnknownElement extends Task {
if (realChild instanceof ProjectComponent) { if (realChild instanceof ProjectComponent) {
((ProjectComponent) realChild).setLocation(child.getLocation()); ((ProjectComponent) realChild).setLocation(child.getLocation());
} }
childWrapper.maybeConfigure(getProject());
child.handleChildren(realChild, childWrapper); child.handleChildren(realChild, childWrapper);
creator.store();
return true; return true;
} }
return false; return false;


Loading…
Cancel
Save