jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: No item in ItemStateManager? Was: Strange exception: javax.jcr.ItemNotFoundException: d1a479a0-b822-43a3-8181-9380635fb02a
Date Tue, 20 Jun 2006 10:31:34 GMT
On 6/19/06, Martin Koci <Martin.Koci@aura.cz> wrote:
> As I'm looking to current code, this exception is thrown with
> SessionItemStateManager, because associated instances of
> TransientItemStateManager and TransientItemStateManager haven'n this
> item.
>
> I don't understand what createItemInstance method in item manager does -
> first called method is for getting state of newly creating item:
>
>         try {
>             state = itemStateProvider.getItemState(id);
>         } catch (NoSuchItemStateException nsise) {
>             throw new ItemNotFoundException(id.toString());
>         }
> But how can  item has such state when we are in method for creating this
> item, so the item doesn't exist yet?

ItemManager#createItemInstance creates, as tis name implies, an ItemImpl
instance. ItemImpl, NodeImpl and PropertyImpl wrap the state of an item and
expose the javax.jcr.Item et al interfaces. so if there's no state, it
can't create
an ItemImpl wrapper. that's all fine.

regarding your problem: please provide a simple test case which reproduces your
issue.

cheers
stefan





>
> Thanks,
>
> Martin
>
> Martin Koci píše v Po 19. 06. 2006 v 12:00 +0200:
> > Hello,
> >
> > I'm adding recursively nodes, but this leads to exception occasionally:
> > javax.jcr.ItemNotFoundException: d1a479a0-b822-43a3-8181-9380635fb02a
> >       at
> > org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:464)
> >       at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:320)
> >       at
> > org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:794)
> >       at
> > org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:738)
> >       at
> > org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:685)
> >       at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1772)
> >       at
> > cz.aura.cms.preferences.impl.PreferencesServiceImpl.addRecursively(PreferencesServiceImpl.java:195)
> >
> >
> > My code is:
> > for (int i = 0; i < nodeNames.length; i++) {
> >           relPath = nodeNames[i];
> >                 if (workNode.hasNode(relPath) == false) {
> >                     Node node = workNode.addNode(relPath);
> >                     workNode = node;
> >                 } else {
> >                     workNode = workNode.getNode(relPath);
> >                 }
> > }
> >
> > Unfortunately this behaviour is not reproducible with test and come on
> > accidentally.
> >
> > Thanks,
> >
> > Martin
> >
> >
> >
>
>

Mime
View raw message