[jdom-interest] IllegalAddException in sort.

Ed Hurst-Frost edward at hurst-frost.net
Tue May 28 09:26:10 PDT 2002


I haven't isolated the problem in a test program yet, but here's some more
info:

src (line numbers) is from jdom-b8 binary package.

Exception stack is:
org.jdom.ContentList.add(int, Element) line: 190
org.jdom.ContentList.add(int, Object) line: 146
org.jdom.ContentList.set(int, Object) line: 663
org.jdom.ContentList$FilterListIterator.set(Object) line: 1150
java.util.Collections.sort(List, Comparator)

Looking at FilterListIterator, it checks for canAdd and canRemove, but
doesn't do remove before add. Could this be the cause of the problem? Should
the relocated object be removed from it's parent at some strategic point
before trying to re-add it?

Ed

----- Original Message -----
From: "Ernst de Haan" <ernsth at nl.euro.net>
To: "Ken Rune Helland" <kenh at csc.no>; <edward at hurst-frost.net>
Cc: <jdom-interest at jdom.org>
Sent: Tuesday, May 28, 2002 4:38 PM
Subject: Re: [jdom-interest] IllegalAddException in sort.


> Hi Ken,
>
> > I think this is to weak because it allows the same element to be in the
> > content list of a parent multiple times. Then you cannot trust
> > that changing one child of an Element won't change another.
>
> What about a moveChild method instead ? Signature would be something like:
>
>    public void moveChild(int srcIndex, int destIndex)
>    throws IllegalArgumentException;
>
> Ernst
>
> --
> Ernst de Haan
> EuroNet Internet B.V.
>
>     "Come to me all who are weary and burdened
>         and I will give you rest" -- Jesus Christ
> _______________________________________________
> 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