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

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

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


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

        

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

Posted by "Ted Husted (JIRA)" <ji...@apache.org>.
     [ 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

        

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

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-1577.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

What is happening here is Struts (XWork really) can't find the Result that you had in mind.  I fixed the bug where the NPE would be thrown, but you'll still see an error for no result found.  Perhaps with the conversion problem it is looking for a result matching "input"?

> 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
>         Assigned To: Don Brown
>             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