Stripes

Converter not used for generic types

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not a Bug
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: Validation
  • Labels:
    None
  • Environment:
    Java 5 on Tomcat 5.5.25

Description

When having a generic type as a field, no converted are used.
In fact, a NullPointerException is thrown by PropertyExpressionEvaluation.

Here is my log.
2008-05-27 10:33:24,000 - DEBUG - debug - Could not bind property with name [relation] to bean of type: ReadRelationVisibilityAction - net.sourceforge.stripes.util.Log - (cloutip) - 114 java.lang.NullPointerException
at net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation.getScalarType(PropertyExpressionEvaluation.java:550)
at net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:150)
at net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:194)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
at ca.qc.ircm.proteus.web.interceptor.HandleErrorsInterceptor.intercept(HandleErrorsInterceptor.java:45)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at ca.qc.ircm.proteus.web.interceptor.RoleInterceptor.intercept(RoleInterceptor.java:63)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at com.mongus.stripes.extension.wait.WaitPageInterceptor.intercept(WaitPageInterceptor.java:169)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:111)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
at net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:190)
at net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:261)
at net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:155)
at net.sourceforge.stripes.controller.DispatcherServlet.doGet(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at net.sourceforge.stripes.controller.DynamicMappingFilter$2.doFilter(DynamicMappingFilter.java:363)
at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:246)
at net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:350)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at ca.qc.ircm.proteus.web.filter.GroupFilter.doFilter(GroupFilter.java:72)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at ca.qc.ircm.proteus.web.filter.ProjectFilter.doFilter(ProjectFilter.java:90)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at ca.qc.ircm.proteus.web.filter.LogFilter.doFilter(LogFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

My action Beans is defined as.
public class ReadRelationVisibilityAction<Rel extends Relation> extends BaseActionBean {
private Rel relation;
// Other code and getter and setter...

I have a concrete Converter class for Relation.

Note that my relation class is abstract.

Activity

Hide
Christian Poitras added a comment - 27/May/08 2:16 PM

Test case that reproduces the problem.

Show
Christian Poitras added a comment - 27/May/08 2:16 PM Test case that reproduces the problem.
Hide
Frederic Daoud added a comment - 16/Mar/11 1:44 PM

Type Converters cannot automatically be used for subclasses of a base class. You must either:

  • use @Validate(converter=MyTypeConverter.class) on the property
  • declare your subclasses in @TargetTypes on the type converter
  • declare an annotation in @TargetTypes on the type converter, use the annotation on your subclasses, and return the proper subclass from the type converter using the targetType parameter which is passed to the convert() method.
Show
Frederic Daoud added a comment - 16/Mar/11 1:44 PM Type Converters cannot automatically be used for subclasses of a base class. You must either:
  • use @Validate(converter=MyTypeConverter.class) on the property
  • declare your subclasses in @TargetTypes on the type converter
  • declare an annotation in @TargetTypes on the type converter, use the annotation on your subclasses, and return the proper subclass from the type converter using the targetType parameter which is passed to the convert() method.

People

Vote (0)
Watch (0)

Dates

  • Created:
    27/May/08 1:47 PM
    Updated:
    16/Mar/11 1:44 PM
    Resolved:
    16/Mar/11 1:44 PM