You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2010/02/10 18:58:28 UTC

[jira] Reopened: (MYFACES-2544) UIViewRoot skips uncorrectly encodeBegin

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

Leonardo Uribe reopened MYFACES-2544:
-------------------------------------


I'll revert the previous patch. The use case you have to consider is when there is an error on a beforePhase listener. If there is, context.getResponseComplete() could return true, inclusive on render response phase. Long time ago, I review MYFACES-2374 and It is known ri does not do this, and this one cause an error on a compatibility test, but in this case the previous behavior is the expected one (the javadoc says so and this one comes from jsf 1.2).

Please note maybe there is a misundersanding about what FacesContext.renderResponse() and FacesContext.getRenderResponse() do. The meaning of this constant is allow jsf to skip phases when an error occur. For example, if a validator throws a RuntimeException, ProcessUpdates and InvokeApplication phases should not be executed, so they will be skipped and RenderResponse phase should occur. Why UIViewRoot.encodeBegin skip render the view? because in jsf 1.2 this is considered an error and encodeBegin should not happen, instead, the error page is published.

Now, PreRenderViewEvent could be used to change the view to be rendered. Just take a look at org.apache.myfaces.lifecycle.RenderResponseExecutor. Its meaning and behavior are different to PreRenderComponentEvent. Maybe the real bug is UIViewRoot does not call 

context.getApplication().publishEvent(context,  PreRenderComponentEvent.class, UIComponent.class, this);

before call encodeBegin(), like UIComponentBase.encodeBegin() does. Maybe this one was ignored, because usually UIViewRoot does not render anything.

Note to solve this issue we have also to check if the new behavior introduced with ExceptionHandler api is compatible with the original jsf 1.2 algorithm.

Jakob, could you take a look at this one again from this point of view?

> UIViewRoot skips uncorrectly encodeBegin
> ----------------------------------------
>
>                 Key: MYFACES-2544
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2544
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Assignee: Jakob Korherr
>             Fix For: 2.0.0-beta-2
>
>         Attachments: MYFACES-2544.patch
>
>
> javax.faces.component.UIViewRoot.encodeBegin(FacesContext) contains:
> if (!skipPhase) {
>    super.encodeBegin(context);
> }
> but skipPhase = context.getRenderResponse() || context.getResponseComplete() - it
> makes sense for all phases except render response phase itself. That condition
> probably should be:
> if (!context.getResponseComplete()) {
>             super.encodeBegin(context);
> }

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