NPE in PropertyExpressionEvaluation.getScalarType with generics
---------------------------------------------------------------
Key: STS-426
URL: http://mc4j.org/jira/browse/STS-426
Project: Stripes
Issue Type: Bug
Components: Validation
Affects Versions: Release 1.4.3
Environment: OpemSolaris / Tomcat 5.5.17
Reporter: Alan Burlison
Assigned To: Tim Fennell
I have a generic class that is used to store result set scrolling information
for query pages. Specifically, the class holds the maximum
and minimum key values for the rows displayed on the page:
public class ResultPageState<K> {
// Methods elided
private K minKey;
private K maxKey;
private boolean moreBefore;
private boolean moreAfter;
}
I store an appropriately-typed instance of this class inside my ActionBeans,
e.g. if the keys are Strings:
private ResultPageState<String> pageState;
In the associated JSP I refer to the pageState as follows:
<ss:hidden name="pageState.minKey"/>
<ss:hidden name="pageState.maxKey"/>
<ss:hidden name="pageState.moreBefore"/>
<ss:hidden name="pageState.moreAfter"/>
When rendering the page the values are retrieved correctly:
<input name="pageState.minKey" value="quinn" type="hidden" />
<input name="pageState.maxKey" value="zach" type="hidden" />
<input name="pageState.moreBefore" value="true" type="hidden" />
<input name="pageState.moreAfter" value="false" type="hidden" />
But during the binding phase of Action submit processing a NPE is thrown:
23 Oct 2007 12:54:59,956 DEBUG Could not bind property with name
[pageState.maxKey] to bean of type: UserSearchAction
java.lang.NullPointerException
at
net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation.getScalarType(PropertyExpressionEvaluation.java:479)
at
net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:265)
at
net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:185)
at
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:157)
at
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:107)
at
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:154)
at
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:73)
at
net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:182)
at
net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:217)
at
net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
The offending code seems to be in
net.sourceforge.stripes.util.beanPropertyExpressionEvaluation.convertToClass
- if it fails to resolve the type to a Class it returns null, and that results
in the NPE in PropertyExpressionEvaluation.getScalarType. The
comments on convertToClass seem to suggest that it should cope with generics,
but in this case it obviously doesn't.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development