Nullsafe method selection?
--------------------------

                 Key: OGNL-46
                 URL: https://issues.apache.org/jira/browse/OGNL-46
             Project: Commons OGNL
          Issue Type: Bug
            Reporter: Christian Grobmeier
            Priority: Minor


For some reason it seems that with Struts 2.3.1 sending a null value does lead 
to confusion in OGNL. For example:

setToken(String token){}

should be set by OGNL. It works, if String != null. If String is null, OGNL 
claims this method does not exist for unknown reason. Probably this is somehow 
related to Struts, but feeling says solution can be found in OGNL.

Workaround is not to send null ;-)


2012-01-13 15:58:29,830 WARN  [CommonsLogger.java:60] : Error setting 
expression 'week' with value '[Ljava.lang.String;@6e895972'
ognl.MethodFailedException: Method "setWeek" failed for object 
de.grobmeier.tab.webapp.services.DateTimeService@332b6f2a 
[java.lang.NoSuchMethodException: 
de.grobmeier.tab.webapp.services.DateTimeService.setWeek([Ljava.lang.String;)]
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1292)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1481)
        at 
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
        at 
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
        at 
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2318)
        at 
com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:77)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2318)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
        at ognl.SimpleNode.setValue(SimpleNode.java:301)
        at ognl.Ognl.setValue(Ognl.java:737)
        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:209)
        at 
com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:173)
        at 
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:160)
        at 
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:151)
        at 
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:292)
        at 
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:203)
        at 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to