commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Updated: (JEXL-62) NPE in Interpreter
Date Wed, 29 Jul 2009 22:25:14 GMT

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

Sebb updated JEXL-62:
---------------------

    Description: 
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}


  was:
The following script works OK when using createExpression() + evaluate(), but causes an NPE
when using createScript() + execute():

{code}
ctxt.getVars().put("dummy", "abcd");
sys=dummy.Class.forName("java.lang.System");
now=sys.currentTimeMillis(); // this works OK
sys.out.println('test'); // This line causes NPE as below

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)
{code}


        Summary: NPE in Interpreter  (was: NPE in Interpreter when using createScript())

> NPE in Interpreter
> ------------------
>
>                 Key: JEXL-62
>                 URL: https://issues.apache.org/jira/browse/JEXL-62
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Sebb
>
> 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.


Mime
View raw message