Tapestry 5
  1. Tapestry 5
  2. TAP5-1011

When using @PageActivationContext and providing a no-args activate event handler, the handler may be called too soon

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.2.1
    • Component/s: tapestry-core
    • Labels:
      None

      Description

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

      @PageActivationContext
      private MyEntity entity;

      void onActivate()

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

      The RuntimeException is thrown even when a valid Entity is in the page activation context.

        Issue Links

          Activity

          Hide
          Hudson added a comment -

          Integrated in tapestry-5.2-freestyle #194 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/194/)
          Merge branch 'TAP5-1011' into trunk

          Show
          Hudson added a comment - Integrated in tapestry-5.2-freestyle #194 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/194/ ) Merge branch ' TAP5-1011 ' into trunk
          Hide
          Alexander Gavrilov added a comment -

          Its seems like the following case still 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(); }


          }

          Shold i clone this issue or you can reopet it?

          Show
          Alexander Gavrilov added a comment - Its seems like the following case still 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(); } } Shold i clone this issue or you can reopet it?
          Hide
          Alexander Gavrilov added a comment -

          It's seems like tapestry skips OnEvent advice for ConcreteClass method and create one for method in BasePage. For PageActivationContext correct work advices must be invoked in the sequence "OnEvent advice" -> "PageActivationContext advice", but in this case the sequence is different.

          Show
          Alexander Gavrilov added a comment - It's seems like tapestry skips OnEvent advice for ConcreteClass method and create one for method in BasePage. For PageActivationContext correct work advices must be invoked in the sequence "OnEvent advice" -> "PageActivationContext advice", but in this case the sequence is different.

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Howard M. Lewis Ship
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development