ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Strange "toString"-behaviour on string resources
Date Mon, 12 Jul 2010 15:30:58 GMT
On 2010-07-10, Hille wrote:

> Running the following build file against ant 1.7.1

> <project default="ant-test">
>   <target name="ant-test" >
>     <resources id="A">
>         <string value="a"/>
>         <string value="b"/>
>     </resources>
>     <union id="union"><resources refid="A"/></union>
>     <echo>
>       A:     ${toString:A}           = a;b
>       union: ${toString:union}           = a;b
>       A:     ${toString:A}           = a;b
>     </echo>
>   </target>
> </project>

> however I got (note the missing "a;b" after the first "A:")

> ant-test:
>      [echo]
>      [echo]       A:                = a;b
>      [echo]       union: a;b           = a;b
>      [echo]       A:     a;b           = a;b
>      [echo]

> I do not think this is an ant bug, but rather me misunderstanding some
> ant concepts.

No, you've really found a bug.  The <resources> resource collection
lazily caches its contents when iterating over the nested resources and
ensures it does so properly for the "normal" resource collection

The toString method in Resources does not ensure it builds up a new
cache when needed.  Your first invocation gets the results of an empty
cache, the union internally iterates over the collection and fills the
cache which is then used by your second invocation.

If you could find the time to open a bugzilla issue for it, that would
be great.  Otherwise I'll do so myself sometime during the rest of the
week - it will be fixed for Ant 1.8.2.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message