[ 
https://issues.apache.org/jira/browse/TAP5-1202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship closed TAP5-1202.
--------------------------------------

      Assignee: Howard M. Lewis Ship
    Resolution: Invalid

I was inaccurate on my blog; the correct order, documented here: 
http://tapestry.apache.org/tapestry5.2-dev/guide/event.html is by number of 
parameters, descending.

The most likely place to do this is inside an activate event handler, with the 
no-args version being called last to do security checks, or to allow for 
graceful handling of a hacked URL that's missing page activation context, etc.

> onActviate called in wrong order
> --------------------------------
>
>                 Key: TAP5-1202
>                 URL: https://issues.apache.org/jira/browse/TAP5-1202
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.2
>            Reporter: Mark Shead
>            Assignee: Howard M. Lewis Ship
>            Priority: Minor
>
> http://tapestryjava.blogspot.com/2007/08/handling-direct-urls-in-tapestry-5.html
> Quote from Howard:
> When a single method is overloaded with different parameters, the order of 
> invocation is fewest parameters to most parameters.
> So onActivate() will be invoked before onActivate(String, String).
> End Quote
> This doesn't appear to be the case. Based on:
>       void onActivate(Contact contact, Address address) {
>               System.out.println("Calling onActivate with 2 parameters");
>               this.contact = contact;
>               this.address = address;
>       }
>       
>       void onActivate(Contact contact) {
>               System.out.println("Calling onActivate with 1 parameter");
>               this.contact = contact;
>               this.address = new Address();
>       }
> produces:
> Calling onActivate with 2 parameters
> Calling onActivate with 1 parameter
> The order described in the blog post would be preferred because it allows you 
> to write multiple versions of onActivate and know that the last one called 
> with be the best match.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to