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

When using @PageActivationContext and override a no-args activate event handler of parent page, the handler called too soon

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Invalid
    • 5.2.0
    • None
    • tapestry-core
    • None

    Description

      It appears that the overrided onActivate() method is called before the @PageActivationContext logic, which means the following can fail:

      public class BasePage {
      private MyEntity entity;

      protected void setEntity(MyEntity entity)

      { this.entity = entity; }

      protected void onActivate()

      { if (entity == null) throw new RuntimeException("Entity not found."); }


      }

      public class ConcreteClass {

      @PageActivationContext
      private MyEntity entity;

      protected void onActivate()

      { setEntity(entity); super.onActivate(); }


      }

      Workaround is do not use methods overriding.

      The problem is the consecuence of Howard's approach: "if the child class overrides a method of the parent, then the overridden method will be invoked only by the parent class". When Tapestry performs transformation it skips OnEventWorker advice, which invoke event handler method of subclass and add it only for parent class. And required for @PageActivationContext chain of invocation breaks. My approach is that if some class override some event handler method of some class then Tapestry should stop advaicing parent class method invocation and should rely on subclass method definition and is the subclass implementor responibility to invoke parent class method.

      Attachments

        Issue Links

          Activity

            People

              hlship Howard Lewis Ship
              lucker Alexander Gavrilov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: