jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Removing a set of nodes via NodeIterator fails
Date Thu, 17 Sep 2009 17:13:00 GMT
On Thu, Sep 17, 2009 at 16:44, herbert <iops@gmx.de> wrote:
> I iterate over a collection of nodes. After the first iteration has
> completed, testNode references to the second node in NodeIterator and I get
> an InvalidItemStateException "the item does not exist anymore" when
> testNode.getName() is executed.
>
> Where is my error? (full code and exception appended.)

Since you query the whole repository, ie. iterate over all nodes, you
might be deleting first a node that is a parent of the second one
(because removal deletes the whole subtree as well). In this case you
get an InvalidItemStateEx, as the Node object is still there but
points to a node that no longer exists (in the transient space).

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message