You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Kočí (Commented JIRA)" <de...@myfaces.apache.org> on 2012/02/14 20:59:59 UTC

[jira] [Commented] (MYFACES-3033) Improve DebugPhaseListener for UIData and SKIP_ITERATION

    [ https://issues.apache.org/jira/browse/MYFACES-3033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13207962#comment-13207962 ] 

Martin Kočí commented on MYFACES-3033:
--------------------------------------

I close this issues as WONT FIX:

1) DebugPhaseListener is now off: context-param: org.apache.myfaces.DEBUG_PHASE_LISTENER=false (MYFACES-3187)
2) the problem is not easily fixable in DebugPhaseListener, because the main evaluation problem comes from javax.faces.component.UIComponent.isVisitable(VisitContext): 

if (hints.contains(VisitHint.SKIP_UNRENDERED) && !this.isRendered())

the !this.isRendered() code evaluates rendered="#{bean.isRendered(row)} and because of SKIP_ITERATION= true is row null. We cannot improve DebugPhaseListener to deal with this problem.

There is a acceptable workaround  in client code: simple not-null check:
public boolean isRendered(Object row) {
	if (row != null) {
	  // evaluate rendered with not null row
	}
	return [false|true];
}
                
> Improve DebugPhaseListener for UIData and SKIP_ITERATION
> --------------------------------------------------------
>
>                 Key: MYFACES-3033
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3033
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: General
>    Affects Versions: 2.1.0
>            Reporter: Martin Kočí
>            Assignee: Martin Kočí
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> <h:dataTable var="row" >
>   <h:column>
>     <h:outputText rendered="#{bean.isRendered(row)}"
> There is new VisitHint.SKIP_ITERATION in JSF 2.1. If that hint is used UIData iterate over children in "flat" manner and therefore no row is available - bean.isRendered(row) obtains null as parameter and NPE can happen. One problem in this situation is a component tree walk before RESTORE_VIEW from DebugPhaseListener:
> java.lang.NullPointerException
> foo.bazz.bean.isRendered
> ...
> at org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
> at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:260)
> at javax.faces.component.UIComponentBase.isRendered
> ...
> at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:991)
> at org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener._doTreeVisit(DebugPhaseListener.java:310)
> at org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener.afterPhase(DebugPhaseListener.java:286)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira