[jdom-interest] beta8 ConcurrentModificationException from Co
ntentList
Mark Hortman
mark.hortman at jcafeinc.com
Mon Aug 5 13:21:14 PDT 2002
I think this is caused because you are trying to nuke something that will
cause the iterator to be modified, so you must now change your
e.removeContent(child);
to i.remove(child)
-----Original Message-----
From: daves.subscriptions at SAFe-mail.net
[mailto:daves.subscriptions at SAFe-mail.net]
Sent: Monday, August 05, 2002 2:59 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] beta8 ConcurrentModificationException from
ContentList
I migrated to JDOM beta8, but I get an error in a test case that walks
through a tree removing subelements recursively:
java.util.ConcurrentModificationException
at
org.jdom.ContentList$FilterListIterator.checkConcurrentModification(ContentL
ist.java:1230)
at org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:942)
It looks like this:
public static void pruneElement(Element e) {
Iterator i = e.getChildren().iterator();
while (i.hasNext()) {
Element child = (Element)i.next();
pruneElement(child);
if (canPrune(child)) {
e.removeContent(child);
}
}
}
Works fine in beta6.
-- Dave
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list