[jdom-interest] Maybe a bug report related to the 'detach' method...
Ken Rune Helland
kenh at csc.no
Thu Apr 11 02:46:44 PDT 2002
> He's a simple example that gets a root element and traverses it's
> children. And when it finds an element with an attribute "name" with
> the value "reporter", it detaches the element.
> But I think that the "detach()" method is not working as expected.
[SNIP]
> I read the FAQ and I saw that we can use the methods contained in the
> "List" class, so,
> I tried to substitute the line "elem.detach();" with
> "kids.remove(elem);". And it gave me the exact same error.
The problem is that any change to the list using someting
else than the iterator invalidates the iterator.
Use the iterators metods to remove the item and it shoud work.
Also if you use the ListIterator instead of the Iterator it shoud
(if correctly implementet) allow modification outside the ListIterator.
KenR
--
e-mail : kenh at csc.no
Tlf : +47 22 95 86 45
Tlf Mob: +47 91 87 27 38
More information about the jdom-interest
mailing list