ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wascally Wabbit <wascallywab...@earthling.net>
Subject Re: recursive expansion of property names
Date Fri, 25 Jun 2004 19:38:52 GMT
At 02:00 PM 6/25/2004, you wrote:
>can you copy-n-paste your resolvePropertiesRecursively method here?  I am 
>getting a wierd error.  I'll trace it through below.  It's wired that it 
>suddenly craps out not finding the 3rd '${' instance (or the 4th instance 
>for that matter).

I think there are problems with the resolvePropertiesRecursivlly method. In 
particular
these two lines look funny to me (haven't debugged thoroughly):

?? sb.replace(nextOpenerIndex, balancingCloserIndex + 
RecursivePropertyParser.CLOSER_LENGTH, fragment);
?? nextOpenerIndex = RecursivePropertyParser.nextOpener(sb.toString(), 
balancingCloserIndex + 1);

The first calc of 'balancingCloserIndex' (not shown) is determined based
on the original string, but the increment code is based on the
string-under-construction. There's no guarantee that the
'balancingCloserIndex' index is even remotely correct for the partially
constructed string. The closer index value should be adjusted
for the difference between the property's name length and the replacing
property value's length. It's not.

Example: if the original string is "${foo}/${${bar}.src}" and "foo" is defined
as "fu" then 'balancingCloserIndex' would be initially set for the 5th
index which would be *WRONG* for the partially constructed buffer of
"fu/${${bar}.src}" as passed to the nextOpener method...the next call to
nextOpener would completely miss the next two $ openers.


The Wabbit 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message