[ 
https://issues.apache.org/jira/browse/JEXL-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henri Biestro updated JEXL-62:
------------------------------

    Attachment: JEXL-62.patch

Fix & test

> NPE in Interpreter
> ------------------
>
>                 Key: JEXL-62
>                 URL: https://issues.apache.org/jira/browse/JEXL-62
>             Project: Commons JEXL
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.0
>
>         Attachments: JEXL-62.patch
>
>
> The following Jexl code script works OK, both for createExpression() + 
> evaluate(), and createScript() + execute():
> {code}
> JexlEngine jexl = new JexlEngine();
> JexlContext ctxt = JexlHelper.createContext();
> ctxt.getVars().put("dummy", "abcd");
> script="dummy.hashCode()"
> jexl.createScript(script).execute(ctxt); // OK
> script="dummy.hashCode()"
> jexl.createExpression(script).evaluate(ctxt); // OK
> {code}
> However, both methods of calling Jexl fail with NPE when the script is 
> changed to
> {code}
> script = "dummy.hashCode"
> {code}
> {code}
> java.lang.NullPointerException
>       at org.apache.commons.jexl.Interpreter.visit(Interpreter.java:890)
>       at 
> org.apache.commons.jexl.parser.ASTReference.jjtAccept(ASTReference.java:17)
>       at org.apache.commons.jexl.Interpreter.visit(Interpreter.java:912)
>       at 
> org.apache.commons.jexl.parser.ASTReferenceExpression.jjtAccept(ASTReferenceExpression.java:17)
>       at org.apache.commons.jexl.Interpreter.visit(Interpreter.java:624)
>       at 
> org.apache.commons.jexl.parser.ASTJexlScript.jjtAccept(ASTJexlScript.java:17)
>       at org.apache.commons.jexl.Interpreter.interpret(Interpreter.java:157)
>       at org.apache.commons.jexl.ScriptImpl.execute(ScriptImpl.java:49)
> java.lang.NullPointerException
>       at org.apache.commons.jexl.Interpreter.visit(Interpreter.java:890)
>       at 
> org.apache.commons.jexl.parser.ASTReference.jjtAccept(ASTReference.java:17)
>       at org.apache.commons.jexl.Interpreter.visit(Interpreter.java:912)
>       at 
> org.apache.commons.jexl.parser.ASTReferenceExpression.jjtAccept(ASTReferenceExpression.java:17)
>       at org.apache.commons.jexl.Interpreter.interpret(Interpreter.java:157)
>       at 
> org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:63)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to