IndexOutOfBoundsException Tree.renderItemByPath

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Normal
    • 9.6.0
    • Affects Version/s: 6.5.8.1, 9.5.0.2
    • Component/s: Components
    • Security Level: Jimmy
    • None

      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

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

              Created:
              Updated:
              Resolved: