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

Martin Grigorov commented on WICKET-6021:
-----------------------------------------

Here is what happens:

- Wicket calls org.apache.wicket.MarkupContainer#internalInitialize() on a 
MarkupContainer
- there #visitChildren() is used to call #onInitialize() on the children of 
this container
- at org.apache.wicket.util.visit.Visits#visitChildren(java.lang.Iterable<? 
super S>, org.apache.wicket.util.visit.IVisitor<S,R>, 
org.apache.wicket.util.visit.IVisitFilter, 
org.apache.wicket.util.visit.Visit<R>) we do: for (final Object child : 
container)
i.e. there Wicket takes an Iterator for this container
- if a child (or a grandchild) adds a component to the "container" then the CME 
is being thrown

IMO it is valid to add components to any branch in the component tree during 
initialization, even somewhere up in the hierarchy.

I have no fix for now.
Any ideas?

> ConcurrentModificationException in MarkupContainer#iterator#next
> ----------------------------------------------------------------
>
>                 Key: WICKET-6021
>                 URL: https://issues.apache.org/jira/browse/WICKET-6021
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.1.0
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>
> I'm upgrading Apache Isis to Wicket 7.1.0 (from 6.20) and I face the 
> following problem:
> java.util.ConcurrentModificationException
>       at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
>       at java.util.ArrayList$Itr.next(ArrayList.java:851)
>       at org.apache.wicket.MarkupContainer$1.next(MarkupContainer.java:553)
>       at org.apache.wicket.MarkupContainer$1.next(MarkupContainer.java:522)
>       at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:134)
>       at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
>       at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
>       at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
>       at org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:192)
>       at 
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:891)
>       at 
> org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:995)
>       at org.apache.wicket.Page.internalPrepareForRender(Page.java:240)
>       at org.apache.wicket.Component.render(Component.java:2304)
>       at org.apache.wicket.Page.renderPage(Page.java:1018)
> I think it is caused by the changes in WICKET-5983



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to