ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: ForTask throwing exception for same value for begin and end
Date Mon, 30 Nov 2009 11:44:52 GMT
<project xmlns:ac="antlib:net.sf.antcontrib">
    <ac:for param="i" begin="0" end="1">
      <sequential>
        <echo>i is @{i}</echo>
      </sequential>
    </ac:for>
</project>

With begin=end=1 you will get the error message
  build.xml:2: end <= begin, step needs to be < 0 

So I see two possibilities:
1) the exceptional 1-jvm-case
   <macrodef name="doit">
     <attribute name="param"/>
   ...
   <ac:if>
     <equals arg1="${end}" "1"/>
     <ac:then> <doit param="1"/> </>
     <ac:else>
       <ac:for ...> <doit param="@{i}"/>

2) NullObject
   Maybe your <sequential> implementation could deal with the value '0' (and do nothing)


Jan


> -----Urspr√ľngliche Nachricht-----
> Von: Harry_ [mailto:harjitworks@gmail.com] 
> Gesendet: Montag, 30. November 2009 11:50
> An: user@ant.apache.org
> Betreff: ForTask throwing exception for same value for begin and end
> 
> 
> Hi,
> 
> I am using ForTask for looping. The end attribute value comes 
> from property.
> I am using it like 
> 
>  <property name="JVMInstances" value="2"/>
> 
>  <for begin="1" end="${JVMInstances}"  param="JVMID"> 
> 
> The above code works fine.
> 
> But when I make the value of JVMInstances as 1, then 
> exception comes during
> the execution of this Ant file.
> 
> Can Any one tell me if it is a known defect that for loop 
> does not work with
> same value of begin and end attribute. I am using
> ise.antelope.tasks.ForTask.
> 
> 
> If this is a defect can anyone tell me how to write a 
> function block in ant.
> This will help me in not writing redundant lines in build 
> file by testing
> above condition in if Block.
> 
> Regards
> -- 
> View this message in context: 
> http://old.nabble.com/ForTask-throwing-exception-for-same-valu
e-for-begin-and-end-tp26572661p26572661.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

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


Mime
View raw message