[jdom-interest] beta8 ConcurrentModificationException from ContentList

daves.subscriptions at SAFe-mail.net daves.subscriptions at SAFe-mail.net
Mon Aug 5 13:36:33 PDT 2002


Thanks, Mark.  i.remove() worked.

-- Dave
-------- Original Message --------
From: Mark Hortman <mark.hortman at jcafeinc.com>
To: "'daves.subscriptions at SAFe-mail.net'" <daves.subscriptions at SAFe-mail.net>, "'jdom-interest at jdom.org'" <jdom-interest at jdom.org>
Subject: RE: [jdom-interest] beta8 ConcurrentModificationException from ContentList
Date: Mon, 5 Aug 2002 15:21:14 -0500

> 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