I am doing rnd for JEXL but i got exception for the below program;
String strDuration = "4560";
long lDuration = Long.parseLong(strDuration);
String theExpression = "" +
"if(lDuration > 500)" +
" return true;" +
"else" +
" return false;";
Expression e = jexl.createExpression( theExpression );
JexlContext context = new MapContext();
context.set("lDuration", lDuration);
Boolean result =(Boolean) e.evaluate(context);
System.out.println("The answer : " + result);
Exception :
Caused by: org.apache.commons.jexl2.parser.ParseException: Ambiguous statement @1:30, missing ‘;’ between expressions
Can anyone help me to display the output that i want(the boolean)?
Thanks in advance.
Here you go:
Edit:
To be clear the problem is your use of the return statement, it appears to not be supported by JEXL.