tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Zeigler (JIRA)" <...@tapestry.apache.org>
Subject [jira] Updated: (TAPESTRY-1662) Render phase short-circuiting is not implemented for methods of the same phase.
Date Tue, 13 May 2008 18:09:55 GMT

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

Robert Zeigler updated TAPESTRY-1662:
-------------------------------------

    Attachment: jira1662sample.tgz

The file I attached contains a tapestry project, generated with the quickstart archetype,
that illustrates the bug.
In short:
There are two mixins: MixinBefore and MixinBefore2.
In Index.tml, an "any" component is given the mixins as: t:mixins="MixedBefore,MixedBefore2".
So MixinBefore is called first, and then MixingBefore2.
MixinBefore's beginRender method returns false; this should short-circuit rendering of the
body of the "any" component, as diagramed in the component state diagram at:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/rendering.html
It will short-circuit it, but according to the last sub-section of the same documentation:

"Short Circuiting

If a method returns a true or false value, this will short circuit processing. Other methods
within the phase that would ordinarily be invoked will not be invoked.

Most render phase methods should return void, to avoid unintentionally short circuiting other
methods for the same phase."

This suggests that the MixedBefore2's beginRender method should NOT be called.
So, in MixedBefore2's beginRender method, an IllegalStateException is thrown.

If you start up the app, and go to the page, you will see that the IllegalStateException is
thrown.

As Nick pointed out, either the documentation needs to be fixed, or the code needs to be fixed,
but they are clearly at odds.


> Render phase short-circuiting is not implemented for methods of the same phase.
> -------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1662
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1662
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Nick Westgate
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>         Attachments: jira1662sample.tgz
>
>
> According to the docs on render phase short-circuiting for methods of the same phase:
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/rendering.html
> "If a method returns a true or false value, this will short circuit processing.
> Other methods within the phase that would ordinarily be invoked will not be invoked."
> This is currently unimplemented. (Only other "inner" phases are short-circuited &
not invoked.)
> Changes would primarily affect:
> org.apache.tapestry.internal.structure.ComponentCallback
> org.apache.tapestry.internal.structure.ComponentPageElementImpl
> In ComponentPageElementImpl.invoke(...), the loop:
>             while (i.hasNext())
>                 callback.run(i.next());
> needs to implement the short circuiting, for example:
>             while (i.hasNext())
>                 if (callback.run(i.next()))
>                     break;
> This change would cascade up to ComponentCallback and all its usage in ComponentPageElementImpl.
> 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


Mime
View raw message