Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1148

AbstractTree utilizes Collections.EMPTY_LIST for a node's children container which causes errors when adding children

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.0-beta1, 1.3.0-beta2, 1.3.0-beta3, 1.3.0-beta4, 1.3.0-rc1
    • 1.3.0-rc2
    • wicket
    • None

    Description

      AbstractTree utilizes Collections.EMPTY_LIST for a node's children container. This assumes that this node will never have children during its lifecycle as EMPTY_LIST will always be empty since it does not support add(int, Object)

      To fix, change item = Collections.EMPTY_LIST with item = new ArrayList(0);

      private final void buildItemChildren(TreeItem item)
      {
      List items;

      // if the node is expanded
      if (isNodeExpanded((TreeNode)item.getModelObject()))

      { // build the items for children of the items' treenode. items = buildTreeItems(nodeChildren((TreeNode)item.getModelObject()), item.getLevel() + 1); }

      else

      { // it's not expanded, just set children to an empty list //items = Collections.EMPTY_LIST; items = new ArrayList(0); }

      item.setChildren(items);
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            rdleeper Doug Leeper
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: