Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4800

Tree NPE when adding/removing model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.6.0
    • 6.5.8.1, 9.5.0.2
    • Components
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      run the code below:

      <zk>
          <tree id="tree"/>
          <zscript><![CDATA[
              tree.setModel(new DefaultTreeModel(new DefaultTreeNode("root")));
              tree.setModel(null);
          ]]></zscript>
      </zk>
      

      Current Result

      15:36:35.919 [qtp122114483-23] ERROR org.zkoss.zk.ui.impl.UiEngineImpl - 
      java.lang.NullPointerException: null
      	at org.zkoss.zul.Tree.renderTree(Tree.java:1990)
      	at org.zkoss.zul.Tree.onInitRender(Tree.java:1870)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3165)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3096)
      	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1890)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1662)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:556)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:377)
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:220)
      ...
      

      Expected Result

      no exception, render empty tree

      Debug Information

      Workaround

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h