[jdom-interest] Bug in ListIterator.add() method

Bradley S. Huffman hip at a.cs.okstate.edu
Fri Apr 22 07:57:12 PDT 2005


Christian Gruber writes:

> As I suppose, Jdoms ListIterator.add() implementation has a problem
> when it is called more than once and when it is called at the end of
> the list.

Looking at the code it looks like the sequence

    listIterator.add(new Element("a"));
    listIterator.add(new Element("b"));
    listIterator.add(new Element("c"));

will produce <c><b><a> instead of <a><b><c> and continue iterating on
element 2 (<b>) instead of after the last new element. That is a bug.

Brad


More information about the jdom-interest mailing list