You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Pascal LAVAUX (Yahoo)" <pl...@yahoo.fr> on 2006/10/11 17:03:04 UTC

[JEXL] Execution difference between Expression and Script

Hi all,

I'm curently  testing JEXL 1.1 for my project and I can't get the Class Script 
working.

When I test the same Jexl code with an Expression it works fine, with a Script 
it does nothing.

[CODE]
  String jexlCode = "resultat.setCode('OK')";
  Expression e = ExpressionFactory.createExpression(jexlCode);
  Script s = ScriptFactory.createScript(jexlCode);

  CodeLibelle resultatJexl = new CodeLibelle();
  JexlContext jc = JexlHelper.createContext();
  jc.getVars().put("resultat", resultatJexl);

  resultatJexl.setCode("");
  e.evaluate(jc);
  out.println("Resultat =" + resultatJexl.getCode());
  resultatJexl.setCode("");
  s.execute(jc);
  out.println("Resultat =" + resultatJexl.getCode());
[/CODE]

The output is:
Resultat=OK
Resultat=

Have anybody an idea?

    Thanks,
-------------------------------------------------------
Pascal LAVAUX                    Responsable Technique
TRIANGLE Informatique              www.triangle-i.com
------------------------------------------------------- 


	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Demandez à ceux qui savent sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com

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


Re: [JEXL] Execution difference between Expression and Script

Posted by Dion Gillard <di...@gmail.com>.
On 10/14/06, Pascal LAVAUX (Yahoo) <pl...@yahoo.fr> wrote:
> No, CodeLibelle is a public class.
>
> In fact I tried 3 or 4 things in my Script, and nothing seemed to work! I
> thaught my code was completly bad, but when I tried a single Expression it
> worked! I can't see what's wrong, I tried with or not semicolon, ... The result
> is always the same.

Can you post the CodeLibelle class?

I've added a test to the ScriptTest class and run it locally. See
http://svn.apache.org/viewvc?view=rev&revision=463704 for details.
That works fine.

I'd appreciate any help recreating your issue, and getting a test that
recreates it.

> One more info, the object return by e.evaluate() or s.execute() is always null.

That's what I'd expect given the expression. The setCode method
doesn't return a value does it? If you had an expression like:
    'resultat.setCode('OK');return resultat.code;'
then I'd expect a non-null return value.

If you could help track this one down, that would be fantastic!

Thanks,

>     Thanks,
>
> ----- Original Message -----
> From: "Dion Gillard" <di...@gmail.com>
> To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
> Sent: Friday, October 13, 2006 5:03 PM
> Subject: Re: [JEXL] Execution difference between Expression and Script
>
>
> >I can recreate this (or a similar problem) if the class CodeLibelle is
> > not marked as public.
> >
> > Is this the case for you?
> >
> > On 10/12/06, Pascal LAVAUX (Yahoo) <pl...@yahoo.fr> wrote:
> >> Hi all,
> >>
> >> I'm curently  testing JEXL 1.1 for my project and I can't get the Class
> >> Script
> >> working.
> >>
> >> When I test the same Jexl code with an Expression it works fine, with a
> >> Script
> >> it does nothing.
> >>
> >> [CODE]
> >>   String jexlCode = "resultat.setCode('OK')";
> >>   Expression e = ExpressionFactory.createExpression(jexlCode);
> >>   Script s = ScriptFactory.createScript(jexlCode);
> >>
> >>   CodeLibelle resultatJexl = new CodeLibelle();
> >>   JexlContext jc = JexlHelper.createContext();
> >>   jc.getVars().put("resultat", resultatJexl);
> >>
> >>   resultatJexl.setCode("");
> >>   e.evaluate(jc);
> >>   out.println("Resultat =" + resultatJexl.getCode());
> >>   resultatJexl.setCode("");
> >>   s.execute(jc);
> >>   out.println("Resultat =" + resultatJexl.getCode());
> >> [/CODE]
> >>
> >> The output is:
> >> Resultat=OK
> >> Resultat=
> >>
> >> Have anybody an idea?
> >>
> >>     Thanks,
> >> -------------------------------------------------------
> >> Pascal LAVAUX                    Responsable Technique
> >> TRIANGLE Informatique              www.triangle-i.com
> >> -------------------------------------------------------
> >>
> >>
> >>
> >>
> >>
> >>
> >> ___________________________________________________________________________
> >> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> >> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
> >> http://fr.answers.yahoo.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >>
> >>
> >
> >
> > --
> > http://www.multitask.com.au/people/dion/
> > Rule of Acquisition #91: Hear all, trust nothing.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>
>
>
>
>
>
> ___________________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
> http://fr.answers.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


-- 
http://www.multitask.com.au/people/dion/
Rule of Acquisition #91: Hear all, trust nothing.

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


Re: [JEXL] Execution difference between Expression and Script

Posted by "Pascal LAVAUX (Yahoo)" <pl...@yahoo.fr>.
No, CodeLibelle is a public class.

In fact I tried 3 or 4 things in my Script, and nothing seemed to work! I 
thaught my code was completly bad, but when I tried a single Expression it 
worked! I can't see what's wrong, I tried with or not semicolon, ... The result 
is always the same.
One more info, the object return by e.evaluate() or s.execute() is always null.

    Thanks,

----- Original Message ----- 
From: "Dion Gillard" <di...@gmail.com>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Friday, October 13, 2006 5:03 PM
Subject: Re: [JEXL] Execution difference between Expression and Script


>I can recreate this (or a similar problem) if the class CodeLibelle is
> not marked as public.
>
> Is this the case for you?
>
> On 10/12/06, Pascal LAVAUX (Yahoo) <pl...@yahoo.fr> wrote:
>> Hi all,
>>
>> I'm curently  testing JEXL 1.1 for my project and I can't get the Class 
>> Script
>> working.
>>
>> When I test the same Jexl code with an Expression it works fine, with a 
>> Script
>> it does nothing.
>>
>> [CODE]
>>   String jexlCode = "resultat.setCode('OK')";
>>   Expression e = ExpressionFactory.createExpression(jexlCode);
>>   Script s = ScriptFactory.createScript(jexlCode);
>>
>>   CodeLibelle resultatJexl = new CodeLibelle();
>>   JexlContext jc = JexlHelper.createContext();
>>   jc.getVars().put("resultat", resultatJexl);
>>
>>   resultatJexl.setCode("");
>>   e.evaluate(jc);
>>   out.println("Resultat =" + resultatJexl.getCode());
>>   resultatJexl.setCode("");
>>   s.execute(jc);
>>   out.println("Resultat =" + resultatJexl.getCode());
>> [/CODE]
>>
>> The output is:
>> Resultat=OK
>> Resultat=
>>
>> Have anybody an idea?
>>
>>     Thanks,
>> -------------------------------------------------------
>> Pascal LAVAUX                    Responsable Technique
>> TRIANGLE Informatique              www.triangle-i.com
>> -------------------------------------------------------
>>
>>
>>
>>
>>
>>
>> ___________________________________________________________________________
>> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
>> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
>> http://fr.answers.yahoo.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
>
> -- 
> http://www.multitask.com.au/people/dion/
> Rule of Acquisition #91: Hear all, trust nothing.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
> 


	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Demandez à ceux qui savent sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com

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


Re: [JEXL] Execution difference between Expression and Script

Posted by Dion Gillard <di...@gmail.com>.
I can recreate this (or a similar problem) if the class CodeLibelle is
not marked as public.

Is this the case for you?

On 10/12/06, Pascal LAVAUX (Yahoo) <pl...@yahoo.fr> wrote:
> Hi all,
>
> I'm curently  testing JEXL 1.1 for my project and I can't get the Class Script
> working.
>
> When I test the same Jexl code with an Expression it works fine, with a Script
> it does nothing.
>
> [CODE]
>   String jexlCode = "resultat.setCode('OK')";
>   Expression e = ExpressionFactory.createExpression(jexlCode);
>   Script s = ScriptFactory.createScript(jexlCode);
>
>   CodeLibelle resultatJexl = new CodeLibelle();
>   JexlContext jc = JexlHelper.createContext();
>   jc.getVars().put("resultat", resultatJexl);
>
>   resultatJexl.setCode("");
>   e.evaluate(jc);
>   out.println("Resultat =" + resultatJexl.getCode());
>   resultatJexl.setCode("");
>   s.execute(jc);
>   out.println("Resultat =" + resultatJexl.getCode());
> [/CODE]
>
> The output is:
> Resultat=OK
> Resultat=
>
> Have anybody an idea?
>
>     Thanks,
> -------------------------------------------------------
> Pascal LAVAUX                    Responsable Technique
> TRIANGLE Informatique              www.triangle-i.com
> -------------------------------------------------------
>
>
>
>
>
>
> ___________________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Demandez à ceux qui savent sur Yahoo! Questions/Réponses
> http://fr.answers.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


-- 
http://www.multitask.com.au/people/dion/
Rule of Acquisition #91: Hear all, trust nothing.

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