You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Martin Perez <mp...@gmail.com> on 2005/10/09 10:44:45 UTC

Problem removing nodes

Hi.

I'm having problems when removing a node. This is my source code (very
simple):

javax.jcr.Node directory = session.getNodeByUUID(directoryId);
directory.remove();
session.save();

But strangely this throws an exception:

java.lang.UnsupportedOperationException: IteratorChains must contain at
least one Iterator
at
org.apache.commons.collections.iterators.IteratorChain.checkChainIntegrity(Unknown
Source)
at org.apache.commons.collections.iterators.IteratorChain.lockChain(Unknown
Source)
at org.apache.commons.collections.iterators.IteratorChain.hasNext(Unknown
Source)
at org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:376)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1215)
at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:765)
at org.jlibrary.core.jcr.JCRRepositoryService.removeDirectory(
JCRRepositoryService.java:127)
at org.jlibrary.client.ui.repository.actions.DeleteAction.deleteDirectory(
DeleteAction.java:275)
at org.jlibrary.client.ui.repository.actions.DeleteAction.deleteItem(
DeleteAction.java:350)
at org.jlibrary.client.ui.repository.actions.DeleteAction.access$1(
DeleteAction.java:343)
at org.jlibrary.client.ui.repository.actions.DeleteAction$1.run(
DeleteAction.java:158)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)

Am I doing something wrong?

Regards,

Martin

Re: Problem removing nodes

Posted by Campbell Allan <ca...@grahamtechnology.com>.
On Sunday 09 October 2005 11:27, Stefan Guggisberg wrote:
> hi martin
>
> On 10/9/05, Martin Perez <mp...@gmail.com> wrote:
> > Hi.
> >
> > I'm having problems when removing a node. This is my source code (very
> > simple):
> >
> > javax.jcr.Node directory = session.getNodeByUUID(directoryId);
> > directory.remove();
> > session.save();
> >
> > But strangely this throws an exception:
> >
> > java.lang.UnsupportedOperationException: IteratorChains must contain at
> > least one Iterator
> > at
> > org.apache.commons.collections.iterators.IteratorChain.checkChainIntegrit
> >y(Unknown Source)
> > at
> > org.apache.commons.collections.iterators.IteratorChain.lockChain(Unknown
> > Source)
> > at org.apache.commons.collections.iterators.IteratorChain.hasNext(Unknown
> > Source)
> > at
> > org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:376)
> > at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1215)
> > at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:765)
> > at org.jlibrary.core.jcr.JCRRepositoryService.removeDirectory(
> > JCRRepositoryService.java:127)
> > at
> > org.jlibrary.client.ui.repository.actions.DeleteAction.deleteDirectory(
> > DeleteAction.java:275)
> > at org.jlibrary.client.ui.repository.actions.DeleteAction.deleteItem(
> > DeleteAction.java:350)
> > at org.jlibrary.client.ui.repository.actions.DeleteAction.access$1(
> > DeleteAction.java:343)
> > at org.jlibrary.client.ui.repository.actions.DeleteAction$1.run(
> > DeleteAction.java:158)
> > at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
> >
> > Am I doing something wrong?
>
> don't think so, looks like a bug to me;) i'll have a look at it tomorrow.
>
> thanks
> stefan
>
> > Regards,
> >
> > Martin

This occurs when commons-collections-2.1 is on the classpath before 3.1. The 
implementation of IteratorChain in 2.1 throws an exception if there are no 
members to iterate over when hasNext() or next() are called. IMO this is 
plain wrong as it changes the definition of Iterator which is the interface 
anyone is likely to use the class with. I think this is why it changed in 
3.1. My current fix was to write a simple wrapper class that caught the 
exception and made the iterator act as I would expect.

Campbell

________________________________________________________________________________
This email (and any attachments) is private and confidential, and is intended
solely for the addressee. If you have received this communication in error
please remove it and inform us via telephone or email.

Although we take all possible steps to ensure mail and attachments are free
from malicious content, malware and viruses, we cannot accept any responsibility
whatsoever for any changes to content outwith our administrative bounds.

The views represented within this mail are solely the view of the
author and do not reflect the views of the organisation as a whole.
________________________________________________________________________________

Graham Technology plc                                   http:// www.grahamtechnology.com
________________________________________________________________________________

Re: Problem removing nodes

Posted by Stefan Guggisberg <st...@gmail.com>.
hi martin

On 10/9/05, Martin Perez <mp...@gmail.com> wrote:
> Hi.
>
> I'm having problems when removing a node. This is my source code (very
> simple):
>
> javax.jcr.Node directory = session.getNodeByUUID(directoryId);
> directory.remove();
> session.save();
>
> But strangely this throws an exception:
>
> java.lang.UnsupportedOperationException: IteratorChains must contain at
> least one Iterator
> at
> org.apache.commons.collections.iterators.IteratorChain.checkChainIntegrity(Unknown
> Source)
> at org.apache.commons.collections.iterators.IteratorChain.lockChain(Unknown
> Source)
> at org.apache.commons.collections.iterators.IteratorChain.hasNext(Unknown
> Source)
> at org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:376)
> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1215)
> at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:765)
> at org.jlibrary.core.jcr.JCRRepositoryService.removeDirectory(
> JCRRepositoryService.java:127)
> at org.jlibrary.client.ui.repository.actions.DeleteAction.deleteDirectory(
> DeleteAction.java:275)
> at org.jlibrary.client.ui.repository.actions.DeleteAction.deleteItem(
> DeleteAction.java:350)
> at org.jlibrary.client.ui.repository.actions.DeleteAction.access$1(
> DeleteAction.java:343)
> at org.jlibrary.client.ui.repository.actions.DeleteAction$1.run(
> DeleteAction.java:158)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
>
> Am I doing something wrong?

don't think so, looks like a bug to me;) i'll have a look at it tomorrow.

thanks
stefan

>
> Regards,
>
> Martin
>
>