[richfaces-issues] [JBoss JIRA] (RF-10154) UIDataAdaptor vs. UIData visitTee small difference

Brian Leathem (JIRA) jira-events at lists.jboss.org
Thu Dec 6 20:10:17 EST 2012


    [ https://issues.jboss.org/browse/RF-10154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574197#comment-12574197 ] 

Brian Leathem edited comment on RF-10154 at 12/6/12 8:08 PM:
-------------------------------------------------------------

Step to reproduce:
{code}
<h:form>
    <h:commandButton action="#{fasole.visitTree(facesContext, view)}" value="Visit" />
    <h:dataTable  value="#{fasole.someItems}" var="zeile">
        <h:column>
            <h:outputText  value="#{zeile}" rendered="#{fasole.isRendered(zeile)}" />
        </h:column>
    </h:dataTable>
</h:form>
{code}

Fasole.java snippet:
{code}
public void visitTree(FacesContext facesContext, UIViewRoot uiViewRoot) {
	VisitContext visitContext = VisitContext.createVisitContext(facesContext, null, Sets.newHashSet(VisitHint.SKIP_UNRENDERED));
	uiViewRoot.visitTree(visitContext, new VisitCallback() {
		@Override
		public VisitResult visit(VisitContext context, UIComponent target) {
			return VisitResult.ACCEPT;
		}
	});
}


public boolean isRendered(Object object) {
	if (null == object) {
		throw new NullPointerException();
	}
	return true;
}
{code}

1) click Visit -> nothing happens
2) change h:dataTable to r:dataTable or r:extendedDataTable and click Visit -> NPE
                
      was (Author: markoc50):
    Step to reproduce:
        <h:form>
            <h:commandButton action="#{fasole.visitTree(facesContext, view)}" value="Visit" />
            <h:dataTable  value="#{fasole.someItems}" var="zeile">
                <h:column>
                    <h:outputText  value="#{zeile}" rendered="#{fasole.isRendered(zeile)}" />
                </h:column>
            </h:dataTable>
        </h:form>

Fasole.java snippet:
	public void visitTree(FacesContext facesContext, UIViewRoot uiViewRoot) {
		VisitContext visitContext = VisitContext.createVisitContext(facesContext, null, Sets.newHashSet(VisitHint.SKIP_UNRENDERED));
		uiViewRoot.visitTree(visitContext, new VisitCallback() {

			@Override
			public VisitResult visit(VisitContext context, UIComponent target) {
				return VisitResult.ACCEPT;
			}
		});
	}


	public boolean isRendered(Object object) {
		if (null == object) {
			throw new NullPointerException();
		}
		return true;
	}

1) click Visit -> nothing happens
2) change h:dataTable to r:dataTable or r:extendedDataTable and click Visit -> NPE
                  
> UIDataAdaptor vs. UIData visitTee small difference
> --------------------------------------------------
>
>                 Key: RF-10154
>                 URL: https://issues.jboss.org/browse/RF-10154
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tables
>    Affects Versions: 4.0.0.Milestone5
>         Environment: RichFaces 4.0.X trunk, svn rev. 20913
>            Reporter: Martin Kočí
>            Priority: Minor
>              Labels: jsf21
>             Fix For: 5-Future
>
>
> {code}
> <r:extendedDataTable var="zeile">
>   <r:column>
>     <h:outputText rendered="#{fasole.method(zeile)}"
>   </r:column>
> </r:extendedDataTable>
> {code}
> +
>  org.richfaces.component.UIDataAdaptor.visitTree(VisitContext, VisitCallback) with VisitHint SKIP_UNRENDERED (in render response phase for example)
> Problem: org.richfaces.component.UIDataAdaptor.visitDataChildren(VisitContext, VisitCallback, boolean) calls visitComponents(getFacetsAndChildren(), visitContext, callback);-> it will visit h:outputText component and test if is rendered -> #{fasole.method(zeile)} but no row available -> calls fasole.method with null parameter and causes an unexpected NPE
> j.f.c.UIData does not visit column chidren for -1 rowIndex (null rowKey in RichFaces), UIData.visitTree JavaDoc says: "Take no action on non-UIColumn children".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the richfaces-issues mailing list