commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maurizio Cucchiara (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OGNL-46) Nullsafe method selection?
Date Sat, 14 Jan 2012 11:04:39 GMT

    [ https://issues.apache.org/jira/browse/OGNL-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186158#comment-13186158
] 

Maurizio Cucchiara commented on OGNL-46:
----------------------------------------

I bet that your week var is an integer and I guess it is something to do with struts type
conversion, after all to what would you implicitly convert a null object? it is a good candidate
for almost everything.
BTW I agree with you, if there is an int setter, there is no reason to look for a string setter.
I'll take a deeper look (as soon as I can) to understand if it is a struts or an ognl related
issue.
                
> 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

        

Mime
View raw message