Incze Lajos wrote:

1. ${antbasename} doesn't change with the iterations.



Don't forget that you are using ant to set this, not jelly. Ant only sets a property once and does not ever overwrite it.



OK. Thanks.




2. The various ${namlen} variables mostly don't work.



What do you mean. 'namelen 1 2' look ok, at 18. 'namelen 5 6 look ok at 18', and 'namelen 7' looks ok at 18. When do any of the namelen variables have wrong values?



I set these namlenX's, and then try to USE is in ${dirname.substring(namlenX). That is what does not work and don't know why.



3. But sometimes do. Both variables (ext and namlen7) work when was set
 by some sort of string indexOf() function (??????).

Etc. What on earth is going on? It's only a couple of examples, I have
others, too. Am I missing something very obvious?

incze



It may be related to Longs vs Ints, and coercion of arguments, take a look at this:
<goal name="test1">
<j:set var="srcbase" value="/opt/data/archive" />
<echo>srcbase ........ ${srcbase}</echo>


<j:set var="source" value="/opt/data/archive/jav/08/01jav.sgm"/>
<echo>source ........ ${source}</echo>
<j:set var="dirname" value="/opt/data/archive/jav/08"/>
<echo>dirname ........ ${dirname}</echo>
<j:set var="namlen5" value="${srcbase.length()+1}" />
<j:set var="namlen6" value="${size(srcbase)+1}" />
<echo>namlen 5 6 ..... ${namlen5} ${namlen6}</echo>
<echo>namlen 5 6 classes..... ${namlen5.getClass()} ${namlen6.getClass()}</echo>
<j:set var="reldir5" value="${dirname.substring(namlen5)}"/>
<echo>reldir5 ........ ${reldir5}</echo>
<j:set var="reldir6" value="${dirname.substring(namlen6)}"/>
<echo>reldir6 ........ ${reldir6}</echo>
<j:set var="namlen7" value="${source.toString().indexOf('j')}" />
<echo>namlen 7 ....... ${namlen7}</echo>
<echo>namlen 7 class....... ${namlen7.getClass()}</echo>
<j:set var="reldir7" value="${dirname.substring(namlen7)}"/>
<echo>reldir7 ........ ${reldir7}</echo>


</goal>

and the output:
test1:
   [echo] srcbase ........ /opt/data/archive
   [echo] source ........ /opt/data/archive/jav/08/01jav.sgm
   [echo] dirname ........ /opt/data/archive/jav/08
   [echo] namlen 5 6 ..... 18 18
   [echo] namlen 5 6 classes..... class java.lang.Long class java.lang.Long
   [echo] reldir5 ........
   [echo] reldir6 ........
   [echo] namlen 7 ....... 18
   [echo] namlen 7 class....... class java.lang.Integer
   [echo] reldir7 ........ jav/08

As you can see, namelen 7 is an Integer, while namelen 5 and 6 are Longs. Now substring takes an int, and I would guess that maybe jelly is silently failing due to an exception trying to pass a long to a method expecting an int. As to why those vars are Longs and not Ints, I would guess it is as a result of the addition operation, where the 1 is treated as a long, and so coerces the entire result to Long. This is not how java works, but jelly expressions don't necessarilly follow correct java rules.




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to