See this example:
public class JexlStuff {
private static final JexlEngine jexl = new JexlBuilder().cache(512).strict(true).silent(false)
.safe(true).create();
public static void main(String[] args) {
JexlScript script = jexl.createScript("var x ='6'; ");
// populate the context
JexlContext context = new MapContext();
Object result = script.execute(context);
System.out.println(result);
if (result != null)
System.out.println(result.getClass());
}
}
This example prints "6" (why?). But there is no return statement. Is it some kind of configuration that will make the above example throw an error, since the script provided could never be "compiled"?
Best scenario for me, this line throws an error:
JexlScript script = jexl.createScript("var x ='6'; ");
Is there a way to validate - check syntax of the given script?
FYI:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl3</artifactId>
<version>3.2.1</version>
</dependency>