Tapestry
  1. Tapestry
  2. TAPESTRY-1730

Order of event handler method invocation should be greatest number of parameters to fewest

    Details

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

      Description

      Say you are writing an activate event handler, meant to guard the page against access without a provided token.

      void onActivate(String token) {
      // validate the token
      }

      Object onPassivate()

      { return _token; }

      Great ... but what about the case where the user omits the token?

      Object onActivate() {
      return _invalidAuthorizationPage; // Redirect away
      }

      But with the current setup, this gets invoked BEFORE onActivate(String) so there's no hope of actually using the page, even with the security token.

        Activity

        Howard M. Lewis Ship created issue -
        Hide
        Howard M. Lewis Ship added a comment -

        The workaround is to have a single onActivate() method that takes Object[]:

        void onActivate(Object[] context)

        { if (context.length != 1) return _invalidAuthorizationPage; String token = (String) context[0]; // validate token return null; // token is ok }
        Show
        Howard M. Lewis Ship added a comment - The workaround is to have a single onActivate() method that takes Object[]: void onActivate(Object[] context) { if (context.length != 1) return _invalidAuthorizationPage; String token = (String) context[0]; // validate token return null; // token is ok }
        Hide
        Nick Westgate added a comment -

        This covers the same issue as TAPESTRY-1695.

        Cheers,
        Nick.

        Show
        Nick Westgate added a comment - This covers the same issue as TAPESTRY-1695 . Cheers, Nick.
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Hide
        Howard M. Lewis Ship added a comment -

        This order is determined by the compare() method of TransformMethodSignature; it is now set up to sort ascending by name, then descending by parameter count (within a single name).

        Show
        Howard M. Lewis Ship added a comment - This order is determined by the compare() method of TransformMethodSignature; it is now set up to sort ascending by name, then descending by parameter count (within a single name).
        Howard M. Lewis Ship made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 5.0.6 [ 12312544 ]
        Mark Thomas made changes -
        Workflow jira [ 12411940 ] Default workflow, editable Closed status [ 12568081 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568081 ] jira [ 12591178 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        21d 5h 38m 1 Howard M. Lewis Ship 22/Sep/07 22:59

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development