Hi Naren,
I've tried to reproduce your problem and failed so I must be missing
something.
Here is the code I tried on 2.1 trunk (added to IssuesTest.java):
public void test130() throws Exception {
JexlEngine jexl = new JexlEngine();
String[] items = { "foo" , "bar", "quux" };
Script s = jexl.createScript("for(var x : items) { if(x.equals(y)) {
return true; } }", "items", "y");
Object r = s.execute(null, items, "bar");
assertEquals(true, r);
r = s.execute(null, items, "froboz");
assertNull(r);
JexlContext ctxt = new MapContext();
ctxt.set("items", items);
ctxt.set("y", "bar");
s = jexl.createScript("for(x : items) { if(x.equals(y)) { return
true; } }");
r = s.execute(ctxt);
assertEquals(true, r);
ctxt.set("y", "froboz");
r = s.execute(ctxt);
assertNull(r);
}
I've also tried with out the 'var x' and a MapContext and with an added
'return false' at the end but couldn't make it fail.
Can you post the actual code that fails on your end?
Thanks,
Regards
Henrib
--
View this message in context:
http://apache-commons.680414.n4.nabble.com/Jexl-Return-statement-tp4392635p4393882.html
Sent from the Commons - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]