Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.1
-
None
-
tomcat 5.5.17, windows xp
Description
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.
Attachments
Issue Links
- is related to
-
WW-1581 Problems with handling of Double in the request parameters
- Closed