[ 
https://issues.apache.org/jira/browse/WICKET-2526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769624#action_12769624
 ] 

Martin Grigorov commented on WICKET-2526:
-----------------------------------------

Quick solution here is to replace in HomePage newTreeState() with 
getTreeState(), i.e.:

final LinkTree linkTree = new LinkTree("tree", treeModel) {
                        @Override
                        public ITreeState getTreeState() {
                                return 
Session.get().getMetaData(USER_SESSION_MENU_TREE_STATE);
                        }
                };


The long story: in AbstractTree#getTreeState() is:

public ITreeState getTreeState()
        {
                if (state == null)
                {
                        state = newTreeState();

                        // add this object as listener of the state
                        state.addTreeStateListener(this);
                        // FIXME: Where should we remove the listener?
                }
                return state;
        }

i.e. it is get the tree state from the Session meta data and add itself as a 
listener. Since DefaultTreeState uses an ArrayList as a container for the 
listeners (not Set + hashCode/equals for each ITreeStateListener) it will add 
the Tree object on each page refresh. 

> ConcurrentModification Exception in TreeState
> ---------------------------------------------
>
>                 Key: WICKET-2526
>                 URL: https://issues.apache.org/jira/browse/WICKET-2526
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.2
>            Reporter: count negative
>         Attachments: sessionSet.zip
>
>
> When the TreeState ist saved in the session, pressing F5 (refresh) in browser 
> many times, leds to an ConcurrentModificationException. Example project is 
> submitted.

-- 
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