[ 
https://issues.apache.org/jira/browse/WICKET-1148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eelco Hillenius resolved WICKET-1148.
-------------------------------------

    Resolution: Fixed

> AbstractTree utilizes Collections.EMPTY_LIST for a node's children container 
> which causes errors when adding children
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1148
>                 URL: https://issues.apache.org/jira/browse/WICKET-1148
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1, 1.3.0-beta2, 1.3.0-beta3, 1.3.0-beta4, 
> 1.3.0-rc1
>            Reporter: Doug Leeper
>             Fix For: 1.3.0-rc2
>
>
> 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);
>       }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to