Ok thank's,
This code works, but can you explain why in th j:arg expression my max
variable is an int but in this expression not : <echo>{max > 0} </echo> 

<j:set var="vers" value="${pom.getVersions()}" />
 
<j:set var="max" value="${size(vers) - 1}" />
<j:invokeStatic className="java.lang.Integer" var="truc"
 method="parseInt">
                <j:arg type="int" value="${max}" />
        </j:invokeStatic>
Thank's for all Vincent
R�my
-----Message d'origine-----
De�: Vincent Massol [mailto:[EMAIL PROTECTED] 
Envoy�: mardi 6 avril 2004 18:15
��: 'Maven Users List'
Objet�: RE: Jelly tag questions

Remy,

The answer is in the stack trace. As with all stack traces you have to
look hard. If you do, you'll see:

Caused by: java.lang.NumberFormatException: For input string: "'3'"

'3' is not a number....

Try with 3

-Vincent

> -----Original Message-----
> From: Menetrieux Remy [mailto:[EMAIL PROTECTED]
> Sent: 06 April 2004 17:34
> To: Maven Users List
> Subject: RE: Jelly tag questions
> 
> Thanks, but I have an other pb:
> <j:invokeStatic className="java.lang.Integer" var="truc"
> method="parseInt">
>               <j:arg type="java.lang.String" value="'3'" />
>       </j:invokeStatic>
> 
> This code make the following error .. :
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.apache.commons.jelly.tags.core.InvokeStaticTag.doTag(InvokeStatic
> Tag.java:162)
>         at
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at
> org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTa
> g.java:78)
>         at
> org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.perfor
> mAction(MavenGoalTag.java:99)
>         at com.werken.werkz.Goal.fire(Goal.java:639)
>         at com.werken.werkz.Goal.attain(Goal.java:575)
>         at
com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
>         at
> org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttai
> nGoalTag.java:126)
>         at
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at
> org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
>         at
org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)
>         at
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at
> org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
>         at
> org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:1
> 45)
>         at
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at
> org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTa
> g.java:78)
>         at
> org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.perfor
> mAction(MavenGoalTag.java:99)
>         at com.werken.werkz.Goal.fire(Goal.java:639)
>         at com.werken.werkz.Goal.attain(Goal.java:575)
>         at
com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
>         at
> org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttai
> nGoalTag.java:126)
>         at
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at
> org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTa
> g.java:78)
>         at
> org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.perfor
> mAction(MavenGoalTag.java:99)
>         at com.werken.werkz.Goal.fire(Goal.java:639)
>         at com.werken.werkz.Goal.attain(Goal.java:575)
>         at
com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
>         at
> org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:
> 531)
>         at
> org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)
>         at org.apache.maven.cli.App.doMain(App.java:466)
>         at org.apache.maven.cli.App.main(App.java:1117)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at com.werken.forehead.Forehead.run(Forehead.java:551)
>         at com.werken.forehead.Forehead.main(Forehead.java:581)
> Caused by: java.lang.NumberFormatException: For input string: "'3'"
>         at
> java.lang.NumberFormatException.forInputString(NumberFormatException.
> java:48)
>         at java.lang.Integer.parseInt(Integer.java:468)
>         at java.lang.Integer.parseInt(Integer.java:518)
>         ... 46 more
> 
> -----Message d'origine-----
> De�: Vincent Massol [mailto:[EMAIL PROTECTED]
> Envoy�: mardi 6 avril 2004 17:15
> ��: 'Maven Users List'
> Objet�: RE: Jelly tag questions
> 
> Hi Remy,
> 
> Your best bet is to call some java code (using <j:invokeStatic> for
> example) for all numerical computations. They are not supported by
JEXL
> (AFAIK).
> 
> -Vincent
> 
> > -----Original Message-----
> > From: Menetrieux Remy [mailto:[EMAIL PROTECTED]
> > Sent: 06 April 2004 17:01
> > To: Maven Users List
> > Subject: Jelly tag questions
> >
> > Hi,
> >
> > I create this code :
> >
> >
> >
> > <j:set var="vers" value="${pom.getVersions()}" />
> >
> >     <j:set var="max" value="${size(vers)}" />
> >
> >       <j:set var="max" value="${max - 1}" />
> >
> >       <j:forEach var="dep" items="${pom.getVersions()}"
> indexVar="index">
> >
> >                   <echo>${ max > 0 }</echo>
> >
> >       </j:forEach>
> >
> > When I execute it, I obtain the following message. It seems that
jelly
> > don't
> > see max as an int. How ca do that ?
> >
> > Sorry for my english thank's.
> >
> > R�my
> >
> >
> >
> > Caught exception evaluating:
> > [EMAIL PROTECTED]
> > Reas
> >
> > on: java.lang.Exception: Invalid comparison : GT
> >
> > java.lang.Exception: Invalid comparison : GT
> >
> >         at
> > org.apache.commons.jexl.parser.ASTGTNode.value(ASTGTNode.java:104)
> >
> >         at
> >
org.apache.commons.jexl.parser.ASTExpression.value(ASTExpression.java
> >
> > :85)
> >
> >         at
> >
org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:1
> >
> > 23)
> >
> >         at
> >
org.apache.commons.jelly.expression.jexl.JexlExpression.evaluate(Jexl
> >
> > Expression.java:115)
> >
> >         at
> >
org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse
> >
> > (ExpressionSupport.java:106)
> >
> >         at
> >
org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsStrin
> >
> > g(ExpressionSupport.java:91)
> >
> >         at
> >
org.apache.commons.jelly.impl.ExpressionScript.run(ExpressionScript.j
> >
> > ava:112)
> >
> >         at
> > org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
> >
> >         at
> > org.apache.commons.jelly.TagSupport.getBodyText(TagSupport.java:271)
> >
> >         at
> org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:205)
> >
> >
> > The information transmitted is intended only for the person or
entity
> to
> > which it is addressed and may contain confidential and/or privileged
> > material. Any review, retransmission, dissemination or other use of,
> or
> > taking of any action in reliance upon, this information by persons
or
> > entities other than the intended recipient is prohibited and may be
a
> > violation of law. If you received this transmission in error, please
> > contact
> > the sender by reply e-mail and delete and destroy all copies of the
> > material, including all copies stored in the recipient's computer,
> printed
> > or saved to disk. Thank you.
> > Software virus: Europcar has taken precautions to minimize the risk
of
> > transmitting software viruses, but we advise you to carry out your
own
> > virus
> > checks on any attachment to this message. Europcar cannot accept
> liability
> > for any loss or damage caused by software viruses.
> > Intellectual Property: Europcar has built up a significant
reputation
> in
> > the
> > name "Europcar" and has a number of trademark applications and
> > registrations
> > in many countries. No trademarks, service marks, and trade names
owned
> or
> > licensed by Europcar or its affiliates may be copied, reproduced,
> > republished, uploaded, posted, transmitted, or distributed in any
way,
> > without the prior written consent of Europcar.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> The information transmitted is intended only for the person or entity
to
> which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of,
or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited and may be a
> violation of law. If you received this transmission in error, please
> contact
> the sender by reply e-mail and delete and destroy all copies of the
> material, including all copies stored in the recipient's computer,
printed
> or saved to disk. Thank you.
> Software virus: Europcar has taken precautions to minimize the risk of
> transmitting software viruses, but we advise you to carry out your own
> virus
> checks on any attachment to this message. Europcar cannot accept
liability
> for any loss or damage caused by software viruses.
> Intellectual Property: Europcar has built up a significant reputation
in
> the
> name "Europcar" and has a number of trademark applications and
> registrations
> in many countries. No trademarks, service marks, and trade names owned
or
> licensed by Europcar or its affiliates may be copied, reproduced,
> republished, uploaded, posted, transmitted, or distributed in any way,
> without the prior written consent of Europcar.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



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

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited and may be a
violation of law. If you received this transmission in error, please contact
the sender by reply e-mail and delete and destroy all copies of the
material, including all copies stored in the recipient's computer, printed
or saved to disk. Thank you.
Software virus: Europcar has taken precautions to minimize the risk of
transmitting software viruses, but we advise you to carry out your own virus
checks on any attachment to this message. Europcar cannot accept liability
for any loss or damage caused by software viruses.
Intellectual Property: Europcar has built up a significant reputation in the
name "Europcar" and has a number of trademark applications and registrations
in many countries. No trademarks, service marks, and trade names owned or
licensed by Europcar or its affiliates may be copied, reproduced,
republished, uploaded, posted, transmitted, or distributed in any way,
without the prior written consent of Europcar.


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

Reply via email to