bodewig 2002/07/17 08:40:14
Modified: src/main/org/apache/tools/ant Project.java
Log:
Make build files that rely on Ant 1.5's behavior work again.
These build files rely on the fact that references to top level data
types get added before the data type's child elements have been
added. In a case like
<path id="foo">
<fileset dir="not-there" />
</path>
The toString method will return "" before the fileset has been added
but throw a BuildException afterwards. A logging statement in
Project#addReference will call toString and thus make the build fail,
while it would work in 1.5 as long as you never use the path.
Revision Changes Path
1.112 +12 -2 jakarta-ant/src/main/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- Project.java 16 Jul 2002 13:06:45 -0000 1.111
+++ Project.java 17 Jul 2002 15:40:14 -0000 1.112
@@ -1777,7 +1777,17 @@
log("Overriding previous definition of reference to " + name,
MSG_WARN);
}
- log("Adding reference: " + name + " -> " + value, MSG_DEBUG);
+
+ String valueAsString = "";
+ try {
+ valueAsString = value.toString();
+ } catch (Throwable t) {
+ log("Caught exception (" + t.getClass().getName() +")"
+ + " while expanding " + name + ": " + t.getMessage(),
+ MSG_WARN);
+ }
+ log("Adding reference: " + name + " -> " + valueAsString,
+ MSG_DEBUG);
references.put(name, value);
}
}
--
To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
|