You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Ted Husted (JIRA)" <ji...@apache.org> on 2006/12/31 01:06:57 UTC

[jira] Updated: (WW-1577) Improve handling of type conversion when loading action from URL

     [ http://issues.apache.org/struts/browse/WW-1577?page=all ]

Ted Husted updated WW-1577:
---------------------------

    Fix Version/s: 2.0.3

> Improve handling of type conversion when loading action from URL
> ----------------------------------------------------------------
>
>                 Key: WW-1577
>                 URL: http://issues.apache.org/struts/browse/WW-1577
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Actions
>    Affects Versions: 2.0.1
>         Environment: tomcat 5.5.17, windows xp
>            Reporter: Dariusz Wojtas
>             Fix For: 2.0.3
>
>
> This issue came up to me several times, most recently when I tried to use autocompleter.
> I have a property in my action:
>    private Integer carMakerId;   // + get/set methods
> After submitting a form with autocompleter
> the browser creates URL
>    /myApp/myAction.action?carMakerId=AUDI&carMakerIdKey=354
> Struts throws an exception:
> ----------------------
> 12:20:00,953 ERROR - Dispatcher                 - Could not execute action
> java.lang.NullPointerException
> 	at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:197)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:337)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
> 	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:217)
> 	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
> 	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:217)
> 	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:154)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:217)
> 	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
> 	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
> 	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:217)
> 	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
>        [...]
> There is nothing wrong with the exception. Integer cannot be loaded with String 'AUDI'. Clear.
> But there is ABSOLUTELY no hint in logs which property causes troubles. It does not even suggest that this is because of some setter problem. Just NullPointerException.
> And that is a real problem when form has 50+ properties and it's difficult to find the reason.
> In the past I had similar problems with the dropdowndatetimepicker tag when it automatically formatted selected date into format that was not understood by struts validators.
> Please make it clear in logs what causes the problem.
> Even a message of type
>    Property 'propName' cannot be set with value '<put the value here>'.
> And 'NullPointerException' is not what I would expect here.
> I think it could
> a) fail as it does now - but with better messages in logs
> b) continue but with this property skipped + provide clear error/warn messages in logs what happened.
> Maybe this could be configurable in struts.properties.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira