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

Chris Wells updated OGNL-179:
-----------------------------
    Reporter: Christian Grobmeier  (was: Christian Grobmeier)

> Nullsafe method selection?
> --------------------------
>
>                 Key: OGNL-179
>                 URL: https://issues.apache.org/jira/browse/OGNL-179
>             Project: Commons OGNL
>          Issue Type: Bug
>            Reporter: Christian Grobmeier
>            Priority: Minor
>             Fix For: 4.0.x
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to