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

Overriding a base class abstract event handler method causes the sub-class method to be invoked twice

    Details

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

      Description

      As of Tapestry 5.3.0 overridden base class methods are causing a second submit, behaviour not present in Tapestry 5.1:

      public abstract class BaseClass {
      public abstract Object onSuccessFromStep1();
      }

      public class SubClass extends BaseClass{

      @Override
      public Object onSuccessFromStep1()

      { if (!foundErrors()) incrementStep(); return null; } }

      onSuccessFromStep1() is invoked twice in this example... the simple workaround is to return true, but this will not suffice when handling objects.

      Comment from Howard:
      I suspect Tapestry is not recognizing that
      SubClass.onSuccessFromStep1() is an override of
      BaseClass.onSuccessFromStep1() (perhaps the abstract flag is throwing
      it).

      So, Tapestry builds code for BaseClass, and implements
      dispatchComponentEvent() to invoke onSuccessFromStep1().

      It then builds code for SubClass, sees onSuccessFromStep1(), doesn't
      think it's an override of the base class method (for whatever reason),
      and implements dispatchComponentEvent() to (a) invoke
      super.dispatchComponentEvent(), and (b) invoke onSuccessFromStep1().
      Thus two invocations.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hlship Howard M. Lewis Ship
                Reporter:
                pstavrinides Peter Stavrinides
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: