Christian Wolfgang Stone created WW-4025:
--------------------------------------------

             Summary: NullPointerException in OgnlTextParser.evaluate().
                 Key: WW-4025
                 URL: https://issues.apache.org/jira/browse/WW-4025
             Project: Struts 2
          Issue Type: Bug
          Components: Core Interceptors
    Affects Versions: 2.3.14
            Reporter: Christian Wolfgang Stone


In the latest code, lukaszlenart refactored some code.  Using a recent build, I 
get the following error (relevant code follows).

java.lang.NullPointerException
        at 
com.opensymphony.xwork2.util.TextParseUtil$1.evaluate(TextParseUtil.java:161)
        at 
com.opensymphony.xwork2.util.OgnlTextParser.evaluate(OgnlTextParser.java:50)
        at 
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:172)
        at 
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:127)
        at 
com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:71)
        at 
org.apache.struts2.dispatcher.StrutsResultSupport.conditionalParse(StrutsResultSupport.java:198)
        at 
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:185)
        at 
org.apache.struts2.dispatcher.ServletRedirectResult.execute(ServletRedirectResult.java:161)
        at 
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
        at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
        at 
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)

The relevant source code is:
 
+        ParsedValueEvaluator ognlEval = new ParsedValueEvaluator() {
+            public Object evaluate(String parsedValue) {
+                Object o = stack.findValue(parsedValue, asType);
+                if (evaluator != null) {
+                    o = evaluator.evaluate(o.toString());
                 }
+                return o;
             }
-        }

Appears as if there is an assumption that the stack.findValue() will always 
return a non-null value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to