Skip to content

Commit

Permalink
Make build files that rely on Ant 1.5's behavior work again.
Browse files Browse the repository at this point in the history
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.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273127 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bodewig committed Jul 17, 2002
1 parent bda2dd0 commit 37ae4e7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/org/apache/tools/ant/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,17 @@ public void addReference(String name, Object value) {
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);
}
}
Expand Down

0 comments on commit 37ae4e7

Please sign in to comment.