You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Nick Westgate (JIRA)" <de...@tapestry.apache.org> on 2007/09/01 03:07:18 UTC

[jira] Updated: (TAPESTRY-1695) Handling of multiple onActivate methods could be improved.

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

Nick Westgate updated TAPESTRY-1695:
------------------------------------

    Issue Type: Bug  (was: Improvement)

This behaviour includes a nasty bug whose behaviour changes over multiple renderings.

Consider:
    public void onActivate(Integer number1, Integer number2, Integer number3) {
        System.out.println("Activated with " + number1 + " " + number2 + " " + number3); }

    public void onActivate(Integer number1, Integer number2) {
        System.out.println("Activated with " + number1 + " " + number2);

Rendering the URL:
http://localhost:8080/myapp/Start/1/2/3

I have seen the first render output from a fresh container startup as:
Activated with 1 2 3

Other times (from fresh startup) or with successive Start.java changes, the output becomes and remains:
Activated with 1 2 3
Activated with 1 2

Cheers,
Nick.

> Handling of multiple onActivate methods could be improved.
> ----------------------------------------------------------
>
>                 Key: TAPESTRY-1695
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1695
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Nick Westgate
>
> The summary is vague because the docs don't yet cover this situation.
> It seems reasonable to have need for something like:
>     Object onActivate() { ... }
>     void onActivate(int itemId) { ... }
> The current event handling calls both these activate methods (the 0 parameters method first, then others).
> I see only two ways of dealing with this:
> (1) Factor out common code and use a flag to avoid executing that code twice
> (2) Replace the two activate methods with:
>     Object onActivate(Object[] parameters) { ... }
> Both options impose some fiddly responsibilities onto the developer.
> Perhaps a resolution is already planned but here are some ideas:
> - call only one event handler
> - allow event handlers to short-circuit (return boolean/Boolean?)
> - swallow coercion exceptions so other event handlers can be tried
> Cheers,
> Nick.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org