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

IndexOutOfBoundsException Tree.renderItemByPath

XMLWordPrintable

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

      Steps to Reproduce

      run attached unit test TreeRenderByPathTest.java

      Current Result

      exception when the path is just 1 greater than the children size

      java.lang.IndexOutOfBoundsException: Index: 3
      
      	at java.base/java.util.AbstractSequentialList.get(AbstractSequentialList.java:90)
      	at org.zkoss.zul.Tree.renderItemByPath(Tree.java:2562)
      	at TreeRenderByPathTest.test(TreeRenderByPathTest.java:45)
      

      Expected Result

      no exception, if the path is incorrect
      return null as in the negative index case or any other case of incorrect path

      Debug Information

      https://github.com/zkoss/zk/blob/v9.5.0.2/zul/src/org/zkoss/zul/Tree.java#L2558
      condition should be using >=

      Workaround

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

              Created:
              Updated:
              Resolved: