Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-980

TreeModel - exception when deleting node

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 3.1.0
    • Fix Version/s: 3.1.4, 3.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Attempting to delete last node within any recursive node set results in exception

      java.lang.IllegalStateException: No tree element available or row key not set!
      org.richfaces.model.StackingTreeModel.isLeaf(StackingTreeModel.java:252)
      org.richfaces.component.UITree.isLeaf(UITree.java:426)
      org.richfaces.renderkit.html.TreeNodeRenderer.doEncodeBegin(TreeNodeRenderer.java:158)
      org.richfaces.renderkit.html.TreeNodeRenderer.doEncodeBegin(TreeNodeRenderer.java:86)

        Gliffy Diagrams

          Activity

          Hide
          maksimkaszynski Maksim Kaszynski added a comment -

          Provided quick fix - made tree update parent node instead of selected one.
          It makes tree handle deletion of nodes correctly.

          Show
          maksimkaszynski Maksim Kaszynski added a comment - Provided quick fix - made tree update parent node instead of selected one. It makes tree handle deletion of nodes correctly.
          Hide
          viktor_volkov Viktor Volkov added a comment -

          WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@156b386) threw exception
          javax.faces.FacesException: java.lang.NullPointerException
          at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:510)
          at org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:397)
          at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:123)
          at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
          at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
          at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
          at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
          at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:122)
          at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:555)
          at org.ajax4jsf.component.AjaxViewRoot$4.invokeRoot(AjaxViewRoot.java:386)
          at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
          at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:173)
          at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:403)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
          at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
          at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
          at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
          at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
          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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
          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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Unknown Source)

          Show
          viktor_volkov Viktor Volkov added a comment - WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@156b386) threw exception javax.faces.FacesException: java.lang.NullPointerException at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:510) at org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:397) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:123) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86) at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134) at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:122) at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:555) at org.ajax4jsf.component.AjaxViewRoot$4.invokeRoot(AjaxViewRoot.java:386) at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56) at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:173) at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:403) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886) at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216) 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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281) 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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)
          Hide
          ilya_shaikovsky Ilya Shaikovsky added a comment -

          Should be assigned to me after fix without resolving. We'll commit them to 3.1.1 if will be fixed before release.

          Show
          ilya_shaikovsky Ilya Shaikovsky added a comment - Should be assigned to me after fix without resolving. We'll commit them to 3.1.1 if will be fixed before release.
          Hide
          pmaho6 Peter Mahoney added a comment -

          Using 3.1.1, when I try to delete the last node I get the following exception:

          javax.faces.FacesException: java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-1)
          at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:510)
          at org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:397)
          ...
          Caused by: java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-1)
          at java.util.SubList.<init>(Unknown Source)
          at java.util.RandomAccessSubList.<init>(Unknown Source)
          at java.util.AbstractList.subList(Unknown Source)
          at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:477)

          Show
          pmaho6 Peter Mahoney added a comment - Using 3.1.1, when I try to delete the last node I get the following exception: javax.faces.FacesException: java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-1) at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:510) at org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:397) ... Caused by: java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-1) at java.util.SubList.<init>(Unknown Source) at java.util.RandomAccessSubList.<init>(Unknown Source) at java.util.AbstractList.subList(Unknown Source) at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:477)
          Hide
          ilya_shaikovsky Ilya Shaikovsky added a comment -

          Put your changes in branch also. Changes provided by Maks - already there.

          Show
          ilya_shaikovsky Ilya Shaikovsky added a comment - Put your changes in branch also. Changes provided by Maks - already there.
          Hide
          nbelaevski Nick Belaevski added a comment -

          Fix applied to 3.1.x

          Show
          nbelaevski Nick Belaevski added a comment - Fix applied to 3.1.x
          Hide
          nbelaevski Nick Belaevski added a comment -

          Resolved

          Show
          nbelaevski Nick Belaevski added a comment - Resolved
          Hide
          ilya_shaikovsky Ilya Shaikovsky added a comment -

          commit please to 3.1.x, because the bug was already partially commited there.

          Show
          ilya_shaikovsky Ilya Shaikovsky added a comment - commit please to 3.1.x, because the bug was already partially commited there.

            People

            • Assignee:
              ayanul Aleksej Yanul
              Reporter:
              maksimkaszynski Maksim Kaszynski
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development