[
https://issues.apache.org/jira/browse/WICKET-6021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14989111#comment-14989111
]
Emond Papegaaij commented on WICKET-6021:
-----------------------------------------
I don't really like this solution. Every iteration of the children of a
component now creates a copy of that list. depending on the number of
components, copying the children can be a very expensive operation. For large
subtrees, it requires the creation of a large array, an ArrayList and a full
iteration over a LinkedHashMap. The ArrayList (and array) need to be
garbage-collected after completion.
I think we should try to find a different solution. Either we do not allow
modifications of the children during iteration, or we make sure the iterator
can handle these cases, without copying the list prior to iteration. The
current solution also has a serious problem: children added during iteration
are not visited.
> 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
> Fix For: 7.2.0, 8.0.0-M1
>
>
> 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)