[jdom-interest] beta8 ConcurrentModificationException from ContentList

daves.subscriptions at SAFe-mail.net daves.subscriptions at SAFe-mail.net
Mon Aug 5 12:59:25 PDT 2002


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(ContentList.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





More information about the jdom-interest mailing list