DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25777>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25777 [PATCH] [REGRESSION] Cannot pass composite path reference between scripts [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[REGRESSION] Cannot pass |[PATCH] [REGRESSION] Cannot |composite path reference |pass composite path |between scripts |reference between scripts ------- Additional Comments From [EMAIL PROTECTED] 2003-12-28 02:17 ------- The attached patch seems to work on the test case, i.e. for <path>. (All unit tests pass with it for me.) It seems that adding a Reference to a Path's 'elements' list just adds the Reference, which itself does not have a reference to the Project. This is OK in and of itself, but when <ant> passes a reference it calls clone(), and Path.clone() just passes along the raw Reference (i.e. name) without any context. So the patch just references the Reference eagerly, when it is added in setRefid. An alternative patch would change clone() to not simply clone 'elements' but create a new list with any Reference's replaced by their referents. However it might be trickier to do that way since I think it would need to also recursively process elements of type Path - perhaps by clone()ing them too. Maybe something like p.elements = (Vector)elements.clone(); // ADDED -> ListIterator i = p.elements.listIterator(); while (i.hasNext()) { Object r = i.next(); if (r instanceof Reference) { // (also check here that it is really a Path) Path p = (Path)r.getReferencedObject(getProject()); i.set(p.clone()); } } // <- ADDED Note #1: I would have thought that the patch would break the usage of adding a reference to a path you have not defined yet, e.g. ---%<--- <path id="path2"> <path refid="path1"/> <pathelement location="bar.jar"/> </path> <path id="path1"> <pathelement location="foo.jar"/> </path> ---%<--- For reasons I don't understand, this seems to work the same as before, with the same odd message as before (message introduced between 1.5.3 and 1.6 beta 3): ---%<--- Buildfile: script1.xml Overriding previous definition of reference to path1 one-A: two-A: [echo] pathval=/tmp/foo.jar:/tmp/bar.jar ---%<--- IMHO it should never have worked (the analogous forward reference does not work for string properties), but perhaps someone relies on this behavior. Note #2: the patch only corrects <path>. I assume that other datatypes in Ant which use refid, e.g. <fileset>, <xmlcatalog>, etc., suffer from the same bug, unless they happen to override clone() in such a way as to dereference all Reference's. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]