[ 
https://issues.jboss.org/browse/RF-11102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brian Leathem updated RF-11102:
-------------------------------

    Description: 
In a tree selection listener method I update the tree itself and get a 
nullpointerexception afterwards:

{code} 
18:43:37,156 SEVERE [org.richfaces.log.Context] null: 
java.lang.NullPointerException
    at 
org.richfaces.model.ClassicTreeNodeDataModelImpl.setupChildContext(ClassicTreeNodeDataModelImpl.java:49)
 [:4.0.0-SNAPSHOT]
    at 
org.richfaces.model.ClassicTreeNodeDataModelImpl.setupChildContext(ClassicTreeNodeDataModelImpl.java:35)
 [:4.0.0-SNAPSHOT]
    at 
org.richfaces.model.NodesTreeSequenceKeyModel.setupKey(NodesTreeSequenceKeyModel.java:47)
 [:4.0.0-SNAPSHOT]
    at 
org.richfaces.model.TreeSequenceKeyModel.setRowKey(TreeSequenceKeyModel.java:49)
 [:4.0.0-SNAPSHOT]
    at org.richfaces.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:277) 
[:]
    at 
org.richfaces.renderkit.TreeRendererBase.encodeSelectionStateInput(TreeRendererBase.java:131)
 [:4.0.0-SNAPSHOT]
    at 
org.richfaces.renderkit.html.TreeRenderer.encodeEnd(TreeRenderer.java:145) 
[:4.0.0-SNAPSHOT]
    at 
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) 
[:2.1.1-FCS]
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763) 
[:2.1.1-FCS]
    at 
org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:514)
 [:4.0.0-SNAPSHOT]
    at 
org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:337)
 [:4.0.0-SNAPSHOT]
    at org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1235) 
[:]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]
    at javax.faces.component.UIForm.visitTree(UIForm.java:335) [:2.1.1-FCS]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]
    ...
{code}

 

The problem seems to occur when a node is selected which is not present in the 
new tree.

But the implementation should be so robust that there is no exception.

I do not reassign the bound root node object, instead I remove all child nodes 
and add the new nodes to the root.

 

The tree definition is:

{code}
<rich:tree value="#{searchBean.suggestTree}" var="node" id="treeSuggest"
nodeClass="com.myapp.web.tree.EstabSuggestTreeNode"
nodeType="#{node.type}" selectionType="ajax"
toggleType="client" render="treeSuggest,detail"
selectionChangeListener="#{searchBean.treeSuggestSelectionChanged}">
<rich:treeNode type="neighborhood">
    <h:outputText value="#{node.name}" />
    </rich:treeNode>
    <rich:treeNode type="estab" >
    <h:outputText value="#{node.name}" />
</rich:treeNode>
</rich:tree>
{code}

  was:
In a tree selection listener method I update the tree itself and get a 
nullpointerexception afterwards:

 

18:43:37,156 SEVERE [org.richfaces.log.Context] null: 
java.lang.NullPointerException

    at 
org.richfaces.model.ClassicTreeNodeDataModelImpl.setupChildContext(ClassicTreeNodeDataModelImpl.java:49)
 [:4.0.0-SNAPSHOT]

    at 
org.richfaces.model.ClassicTreeNodeDataModelImpl.setupChildContext(ClassicTreeNodeDataModelImpl.java:35)
 [:4.0.0-SNAPSHOT]

    at 
org.richfaces.model.NodesTreeSequenceKeyModel.setupKey(NodesTreeSequenceKeyModel.java:47)
 [:4.0.0-SNAPSHOT]

    at 
org.richfaces.model.TreeSequenceKeyModel.setRowKey(TreeSequenceKeyModel.java:49)
 [:4.0.0-SNAPSHOT]

    at org.richfaces.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:277) 
[:]

    at 
org.richfaces.renderkit.TreeRendererBase.encodeSelectionStateInput(TreeRendererBase.java:131)
 [:4.0.0-SNAPSHOT]

    at 
org.richfaces.renderkit.html.TreeRenderer.encodeEnd(TreeRenderer.java:145) 
[:4.0.0-SNAPSHOT]

    at 
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) 
[:2.1.1-FCS]

    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763) 
[:2.1.1-FCS]

    at 
org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:514)
 [:4.0.0-SNAPSHOT]

    at 
org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:337)
 [:4.0.0-SNAPSHOT]

    at org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1235) 
[:]

    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]

    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]

    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]

    at javax.faces.component.UIForm.visitTree(UIForm.java:335) [:2.1.1-FCS]

    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]

    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
[:2.1.1-FCS]

...

 

The problem seems to occur when a node is selected which is not present in the 
new tree.

But the implementation should be so robust that there is no exception.

I do not reassign the bound root node object, instead I remove all child nodes 
and add the new nodes to the root.

 

The tree definition is:

 

<rich:tree value="#{searchBean.suggestTree}" var="node" id="treeSuggest"

nodeClass="com.myapp.web.tree.EstabSuggestTreeNode"

nodeType="#{node.type}" selectionType="ajax"

toggleType="client" render="treeSuggest,detail"

selectionChangeListener="#{searchBean.treeSuggestSelectionChanged}">

<rich:treeNode type="neighborhood">

    <h:outputText value="#{node.name}" />

    </rich:treeNode>

    <rich:treeNode type="estab" >

    <h:outputText value="#{node.name}" />

</rich:treeNode>

</rich:tree>



> NullPointerException in rich:tree node selection
> ------------------------------------------------
>
>                 Key: RF-11102
>                 URL: https://issues.jboss.org/browse/RF-11102
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tree
>    Affects Versions: 4.0.0.Final
>            Reporter: u j
>
> In a tree selection listener method I update the tree itself and get a 
> nullpointerexception afterwards:
> {code} 
> 18:43:37,156 SEVERE [org.richfaces.log.Context] null: 
> java.lang.NullPointerException
>     at 
> org.richfaces.model.ClassicTreeNodeDataModelImpl.setupChildContext(ClassicTreeNodeDataModelImpl.java:49)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.model.ClassicTreeNodeDataModelImpl.setupChildContext(ClassicTreeNodeDataModelImpl.java:35)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.model.NodesTreeSequenceKeyModel.setupKey(NodesTreeSequenceKeyModel.java:47)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.model.TreeSequenceKeyModel.setRowKey(TreeSequenceKeyModel.java:49)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:277) [:]
>     at 
> org.richfaces.renderkit.TreeRendererBase.encodeSelectionStateInput(TreeRendererBase.java:131)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.renderkit.html.TreeRenderer.encodeEnd(TreeRenderer.java:145) 
> [:4.0.0-SNAPSHOT]
>     at 
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) 
> [:2.1.1-FCS]
>     at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763) 
> [:2.1.1-FCS]
>     at 
> org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:514)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:337)
>  [:4.0.0-SNAPSHOT]
>     at 
> org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1235) [:]
>     at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
> [:2.1.1-FCS]
>     at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
> [:2.1.1-FCS]
>     at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
> [:2.1.1-FCS]
>     at javax.faces.component.UIForm.visitTree(UIForm.java:335) [:2.1.1-FCS]
>     at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
> [:2.1.1-FCS]
>     at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) 
> [:2.1.1-FCS]
>     ...
> {code}
>  
> The problem seems to occur when a node is selected which is not present in 
> the new tree.
> But the implementation should be so robust that there is no exception.
> I do not reassign the bound root node object, instead I remove all child 
> nodes and add the new nodes to the root.
>  
> The tree definition is:
> {code}
> <rich:tree value="#{searchBean.suggestTree}" var="node" id="treeSuggest"
> nodeClass="com.myapp.web.tree.EstabSuggestTreeNode"
> nodeType="#{node.type}" selectionType="ajax"
> toggleType="client" render="treeSuggest,detail"
> selectionChangeListener="#{searchBean.treeSuggestSelectionChanged}">
> <rich:treeNode type="neighborhood">
>     <h:outputText value="#{node.name}" />
>     </rich:treeNode>
>     <rich:treeNode type="estab" >
>     <h:outputText value="#{node.name}" />
> </rich:treeNode>
> </rich:tree>
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to