Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-822

Strange error when trying to reference property from hierarchy of generic classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.1.0.5
    • 5.2
    • tapestry-core
    • None

    Description

      In my page template I want to print "timeRange" property value of my custom entity object that is generic subclass of some other generic superclass.

      Time range value: ${openReservationSubrequest.timeRange}

      Inside my page I have just :

      public OpenReservationSubrequest getOpenReservationSubrequest() {
      return openReservationSubrequest;
      }

      ..and my class is defined like this where superclass (TimeRangedReservationSubrequest) contains "timeRange" property:
      public abstract class OpenReservationSubrequest<A extends Access, R extends Reservation<A>> extends TimeRangedReservationSubrequest<R> {

      Tapestry 5.1.0.5 raises following error:

      Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Could not convert 'openReservationSubrequest.timeRange' into a component parameter binding: java.lang.ArrayIndexOutOfBoundsException: 1
      at org.apache.tapestry5.internal.services.BindingSourceImpl.newBinding(BindingSourceImpl.java:85) [tapestry-core-5.1.0.5.jar:na]
      at $BindingSource_1234622cb0f.newBinding($BindingSource_1234622cb0f.java) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PageElementFactoryImpl.newExpansionElement(PageElementFactoryImpl.java:165) [tapestry-core-5.1.0.5.jar:na]
      at $PageElementFactory_1234622cb06.newExpansionElement($PageElementFactory_1234622cb06.java) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.pageload.PageLoaderImpl$15.execute(PageLoaderImpl.java:1033) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.runActions(ComponentAssemblerImpl.java:202) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.assembleRootComponent(ComponentAssemblerImpl.java:88) [tapestry-core-5.1.0.5.jar:na]
      ... 99 common frames omitted
      Caused by: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1
      at org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.buildAdapter(PropertyAccessImpl.java:96) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.getAdapter(PropertyAccessImpl.java:65) [tapestry-ioc-5.1.0.5.jar:na]
      at $PropertyAccess_1234622cabc.getAdapter($PropertyAccess_1234622cabc.java) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.infoForPropertyNode(PropertyConduitSourceImpl.java:939) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.infoForPropertyOrMethod(PropertyConduitSourceImpl.java:932) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.createGetterAndSetter(PropertyConduitSourceImpl.java:421) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.createAccessors(PropertyConduitSourceImpl.java:407) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.createInstance(PropertyConduitSourceImpl.java:260) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.build(PropertyConduitSourceImpl.java:1205) [tapestry-core-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.create(PropertyConduitSourceImpl.java:1080) [tapestry-core-5.1.0.5.jar:na]
      at $PropertyConduitSource_1234622cb27.create($PropertyConduitSource_1234622cb27.java) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.bindings.PropBindingFactory.newBinding(PropBindingFactory.java:49) [tapestry-core-5.1.0.5.jar:na]
      at $BindingFactory_1234622cb28.newBinding($BindingFactory_1234622cb28.java) [tapestry-ioc-5.1.0.5.jar:na]
      at $BindingFactory_1234622cb20.newBinding($BindingFactory_1234622cb20.java) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.internal.services.BindingSourceImpl.newBinding(BindingSourceImpl.java:81) [tapestry-core-5.1.0.5.jar:na]
      ... 105 common frames omitted
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
      at org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractGenericReturnType(GenericsUtils.java:75) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.ioc.internal.services.ClassPropertyAdapterImpl.<init>(ClassPropertyAdapterImpl.java:47) [tapestry-ioc-5.1.0.5.jar:na]
      at org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.buildAdapter(PropertyAccessImpl.java:92) [tapestry-ioc-5.1.0.5.jar:na]
      ... 119 common frames omitted

      Everything works fine if I expose my page property as superclass such as :

      public TimeRangedReservationSubrequest getTimeRangedReservationSubrequest()
      return openReservationSubrequest;
      }

      and use
      ${timeRangedReservationSubrequest.timeRange}

      Attachments

        Activity

          People

            Unassigned Unassigned
            vjeran@tis.hr Vjeran Marcinko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: