Thanks David,
Unfortunately I have no control over the contents of the file I'm parsing, and
I don't want to insert place holders.
I located the code that introduces this "feature" and have changed it locally
to work as I need it, but I would appreciate some feedback on what it might
break (if anything). It obviously does this for some reason, though there are
no hints in the code.
Modified code from 1.7.1 tag in svn:
org.apache.tools.ant.PropertyHelper.parsePropertyStringDefault(String, Vector,
Vector)
...
if (value.charAt(pos + 1) == '$') {
//backwards compatibility two $ map to one mode
fragments.addElement("$");
// MY CHANGE: Don't jump over double dollars.
// prev = pos + 2;
prev = pos + 1;
...
Regards,
Chris Holman
-----Original Message-----
From: David Weintraub [mailto:[email protected]]
Sent: 17 August 2011 17:32
To: Ant Users List
Subject: Re: Problems using properties containing multiple dollar signs.
On Wed, Aug 17, 2011 at 11:04 AM, Holman, Chris <[email protected]> wrote:
> This ant script snippet:
> <property name="lineOfTestLine" value="$ $$ $$$ $$$$ $$$$$ $$$$$$">
> <echo message="${lineOfTestLine}">
>
> Prints out:
> [echo] $ $ $$ $$ $$$ $$$
>
Interestingly, I ran the following test:
<project>
<property name="test1" value='$ $$ $$$ $$$$ $$$$$ $$$$$$'/> <!--
Try single quotes -->
<echo message="TEST #1 = ${test1}/> <!-- Prints $ $ $$ $$ $$$ $$$-->
<condition property="test2" value="test2 matches">
<equals arg1="${test1}" value="$ $$ $$$ $$$$ $$$$$ $$$$$$$"/>
</condition>
<echo message="TEST #2: ${test2}"/> <!-- Prints "TEST #2: test2 matches-->
<condition property="test3" value="test3 matches">
<equals arg1="${test1}" value="$ $ $$ $$ $$$ $$$"/>
</condition>
<echo message="TEST #3: ${test3}"/> <!-- Prints "TEST #3: ${test3}-->
</project>
So, the value of the variable seems correct, but the echo is wrong.
However, this does work:
<project>
<property name="dlr" value='$'/>
<property name="test1" value="${dlr} ${dlr}${dlr}
${dlr}${dlr}${dlr} ${dlr}${dlr}${dlr}${dlr}
${dlr}${dlr}${dlr}${dlr}${dlr} ${dlr}${dlr}${dlr}${dlr}${dlr}${dlr}"/>
<!-- Try single quotes -->
<echo message="TEST #1 = ${test1}/> <!-- Prints $ $$ $$$ $$$$
$$$$$ $$$$$$-->
<condition property="test2" value="test2 matches">
<equals arg1="${test1}" value="$ $$ $$$ $$$$ $$$$$ $$$$$$$"/>
</condition>
<echo message="TEST #2: ${test2}"/> <!-- Prints "TEST #2: test2 matches-->
<condition property="test3" value="test3 matches">
<equals arg1="${test1}" value="$ $ $$ $$ $$$ $$$"/>
</condition>
<echo message="TEST #3: ${test3}"/> <!-- Prints "TEST #3: ${test3}-->
</project>
So, by declaring a variable equal to "$" and using that instead of
dollar signs seems to work.
--
David Weintraub
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Information in this email including any attachments may be privileged,
confidential and is intended exclusively for the addressee. The views expressed
may not be official policy, but the personal views of the originator. If you
have received it in error, please notify the sender by return e-mail and delete
it from your system. You should not reproduce, distribute, store, retransmit,
use or disclose its contents to anyone. Please note we reserve the right to
monitor all e-mail communication through our internal and external networks.
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and
are used under licence. British Sky Broadcasting Limited (Registration No.
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky
Broadcasting Group plc (Registration No. 2247735). All of the companies
mentioned in this paragraph are incorporated in England and Wales and share the
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]