10 Replies Latest reply on Oct 4, 2007 5:48 AM by Jonas Buechel

    Tree selection Problem since 3.1.0 (Need help Nick)

    Jonas Buechel Novice

      I implemented a tree using richfaces 3.1.0-rc2. This is the source which is adapted to 3.1.0:

      <h:form>
       <rich:panel styleClass="fwc-panel-noborder">
       <rich:tree id="organigramTreeId" switchType="server" showConnectingLines="false"
       stateAdvisor="#{organigramTreeStateAdvisor}"
       ajaxSubmitSelection="true" reRender="fwcToolbar, organigramForm, militaryRoleTableId"
       icon="#{fwcResource.resourcePathWeb}#{theme.img}tree/folder_closed.png"
       iconCollapsed="#{fwcResource.resourcePathWeb}#{theme.img}tree/expand.gif"
       iconExpanded="#{fwcResource.resourcePathWeb}#{theme.img}tree/collapse.gif"
       iconLeaf="#{fwcResource.resourcePathWeb}#{theme.img}tree/folder_closed.png">
      
       <rich:treeNodesAdaptor id="missionNode" nodes="#{organigramTreeModel}" var="missionNode">
      
       <rich:treeNode nodeSelectListener="#{organigramTreeModelManager.select(missionNode)}">
       <h:outputText value="#{missionNode.name}" />
       </rich:treeNode>
      
       <rich:recursiveTreeNodesAdaptor id="organigramNode" var="organigramNode"
       roots="#{missionNode.organigramNodesAsList}"
       nodes="#{organigramNode.childNodesAsList}">
      
       <rich:treeNode
       nodeSelectListener="#{organigramTreeModelManager.select(organigramNode)}">
       <h:outputText value="#{organigramNode.name}" />
       <h:outputText value=" : " />
       <h:outputText value="#{organigramNode.sorter}" />
       </rich:treeNode>
      
       </rich:recursiveTreeNodesAdaptor>
       </rich:treeNodesAdaptor>
      
       </rich:tree>
       </rich:panel>
       </h:form>
      

      Since i'm using the libraries of richfaces 3.1.0 release sometimes(!) during navigating through the tree i get an IllegalStateException.
      How i reproduce it:
      1. Expand an node
      2. Expand one of its child nodes
      3. Expand one of its child nodes
      4. Select one of its child nodes

      Exception:
      java.lang.IllegalStateException: No tree element available or row key not set!
       at org.richfaces.model.StackingTreeModel.getCurrentModel(StackingTreeModel.java:79)
       at org.richfaces.model.VisualStackingTreeModel.getComponent(VisualStackingTreeModel.java:37)
       at org.richfaces.component.UITree.getNodeFacet(UITree.java:241)
       at org.richfaces.component.UITree.dataChildren(UITree.java:415)
       at org.ajax4jsf.component.UIDataAdaptor.restoreChildState(UIDataAdaptor.java:857)
       at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:325)
       at org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1170)
       at org.richfaces.component.UITree.broadcast(UITree.java:478)
       at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
       at org.ajax4jsf.component.AjaxViewRoot.broadcastAjaxEvents(AjaxViewRoot.java:206)
       at org.ajax4jsf.application.AjaxViewHandler.processAjaxEvents(AjaxViewHandler.java:257)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:213)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:63)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      13:51:37,859 WARN [lifecycle] phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@1ad4a49) threw exception: java.lang.NullPointerException null
      

      I don't have any clue why there is an illegal state.. it doesn't happen if i use the richfaces 3.1.0-rc2 libraries.

      Please help!