Community
Participate
Working Groups
The following exception was encountered after generating JAXB classes from a large schema: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(Unknown Source) at java.util.HashMap$ValueIterator.next(Unknown Source) at java.util.AbstractCollection.toArray(Unknown Source) at org.eclipse.jpt.common.utility.internal.iterators.CloneIterator.<init>(CloneIterator.java:72) at org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable.iterator(LiveCloneIterable.java:77) at org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable.iterator(FilteringIterable.java:66) at org.eclipse.jpt.common.utility.internal.model.value.AspectCollectionValueModelAdapter.iterator_(AspectCollectionValueModelAdapter.java:85) at org.eclipse.jpt.common.utility.internal.model.value.AspectCollectionValueModelAdapter.iterator(AspectCollectionValueModelAdapter.java:76) at org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider.childrenModel(AbstractTreeItemContentProvider.java:110) at org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider.hasChildren(AbstractTreeItemContentProvider.java:170) at org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider.hasChildren(DelegatingTreeContentAndLabelProvider.java:56) at org.eclipse.jpt.jaxb.ui.internal.navigator.JaxbNavigatorContentProvider.hasChildren(JaxbNavigatorContentProvider.java:122) at org.eclipse.ui.internal.navigator.extensions.SafeDelegateTreeContentProvider.hasChildren(SafeDelegateTreeContentProvider.java:110) at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.callNormalHasChildren(NavigatorContentServiceContentProvider.java:430) at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.access$4(NavigatorContentServiceContentProvider.java:425) at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider$3.run(NavigatorContentServiceContentProvider.java:395) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.hasChildren(NavigatorContentServiceContentProvider.java:381) at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.hasChildren(NavigatorContentServiceContentProvider.java:422) ...
This is a case where a Hashtable is needed as opposed to the HashMap that is being used.
(In reply to comment #1) > This is a case where a Hashtable is needed as opposed to the HashMap that is > being used. This statement was a bit simplistic. After saying this, I'm not sure that Hashtable's synchronized nature would actually prevent a concurrent mod exception in this case, depending on how the collection was modified. ConcurrentHashMap would likely be a better option if we were moving the BREE to 1.6, but for now we wish to keep it at 1.5 for this plugin.
Brian reminded me that this issue is specifically related to the collection.toArray() that is being performed in the CloneIterator constructor, which is not a syncronized collection of values in the case of the HashMap, but would be in the case of a Hashtable, since Hashtable.values() would return a SyncronizedCollection. As a result, the use of a Hashtable in this case should in fact prevent this particular problem from occurring.
See AbstractJaxbContextRoot 'packages' as the Map in question.
GenericJavaClassMapping 'includedAttributesContainers' is a HashMap as well
fixed in HEAD
Verified in Build S-3.1.0-20111117042513 Verified when you import large schemas exceptions do not occur. See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.1_RC1