conor 2002/06/09 03:04:07
Modified: src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
RuntimeConfigurable.java UnknownElement.java
Log:
Allow RuntimeConfigurable to be reused
Do not replace UnknownElements with their actual class so redefinitions
get recreated.
PR: 9675
Revision Changes Path
No revision
No revision
1.14.2.1 +30 -23
jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
Index: RuntimeConfigurable.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -w -u -r1.14 -r1.14.2.1
--- RuntimeConfigurable.java 9 Apr 2002 15:27:07 -0000 1.14
+++ RuntimeConfigurable.java 9 Jun 2002 10:04:07 -0000 1.14.2.1
@@ -79,6 +79,8 @@
private AttributeList attributes;
/** Text appearing within the element. */
private StringBuffer characters = new StringBuffer();
+ /** Indicates if the wrapped object has been configured */
+ private boolean proxyConfigured = false;
/**
* Sole constructor creating a wrapper for the specified object.
@@ -90,6 +92,7 @@
public RuntimeConfigurable(Object proxy, String elementTag) {
wrappedObject = proxy;
this.elementTag = elementTag;
+ proxyConfigured = false;
}
/**
@@ -100,6 +103,7 @@
*/
void setProxy(Object proxy) {
wrappedObject = proxy;
+ proxyConfigured = false;
}
/**
@@ -197,14 +201,16 @@
public void maybeConfigure(Project p) throws BuildException {
String id = null;
+ if (proxyConfigured) {
+ return;
+ }
+
if (attributes != null) {
ProjectHelper.configure(wrappedObject, attributes, p);
id = attributes.getValue("id");
- attributes = null;
}
if (characters.length() != 0) {
ProjectHelper.addText(p, wrappedObject, characters.toString());
- characters.setLength(0);
}
Enumeration enum = children.elements();
while (enum.hasMoreElements()) {
@@ -224,6 +230,7 @@
if (id != null) {
p.addReference(id, wrappedObject);
}
+ proxyConfigured = true;
}
}
1.26.2.1 +17 -22
jakarta-ant/src/main/org/apache/tools/ant/UnknownElement.java
Index: UnknownElement.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/UnknownElement.java,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -u -w -u -r1.26 -r1.26.2.1
--- UnknownElement.java 9 Apr 2002 15:27:08 -0000 1.26
+++ UnknownElement.java 9 Jun 2002 10:04:07 -0000 1.26.2.1
@@ -122,11 +122,6 @@
handleChildren(realThing, wrapper);
wrapper.maybeConfigure(project);
- if (realThing instanceof Task) {
- target.replaceChild(this, (Task) realThing);
- } else {
- target.replaceChild(this, wrapper);
- }
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>