ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "broken connection" <>
Subject Variable task - unset attribute issue
Date Thu, 12 Jul 2007 17:29:18 GMT
Hi Friends,
I am having a problem with empty strings. I have this simple build file:

 <project name="test" default="test_iteration">
 <taskdef resource="net/sf/antcontrib/antlib.xml" />

 <target name="test_iteration">
         <var name="counter" value="0"/>
        <for list="parameter1,parameter2,parameter3" param="arg" >


        <math result="counter" operand1="${counter}" operation="+"
operand2="1" datatype="int"/>
        <var name="" unset="true"/>

        <java classname="GeneratePassword" fork="true">
            <arg value="@{arg}" />
            <redirector outputproperty="" />

            <equals arg1="${counter}" arg2="1"/>
                <property name="property1" value="${}" />

            <equals arg1="${counter}" arg2="2"/>
                <property name="property2" value="${}" />

            <equals arg1="${counter}" arg2="3"/>
                <property name="property3" value="${}" />



     [echo] 1:PARAMETER1
     [echo] 2:PARAMETER2
     [echo] 3:PARAMETER3

Now,if I pass the second parameter as EMPTY STRING i.e:
    <for list="parameter1,,parameter3" param="arg" >

Actual Output I get:

     [echo] 1:PARAMETER1
     [echo] 2:PARAMETER3

Expected Output I get:

     [echo] 1:PARAMETER1
     [echo] 3:PARAMETER3

So,can someone explain me when I pass in an empty string, why the second
loop runs instead of third.I think this "unset" is the cause of the error:
<var name="" unset="true"/>

But can someone please tell me how to resolve this.My test java class is
very simple,it takes a argument and returns the uppercase of when
so argument is specified,it returns nothing.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message