Another bit of info on this issue - if I call session.save() prior trying to 
get the child nodes, I end up with:


javax.jcr.InvalidItemStateException: Unable to update a stale item: item.save()
        at 
org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:262)
        at 
org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
        at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
        at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329)
….
Caused by: org.apache.jackrabbit.core.state.StaleItemStateException: 
b09228e5-ecca-45e0-9cb4-660337e846ed has been modified externally

So yeah, cause is clear, there was another session that modified the item in 
the mean time. However it doesn't seem right to me that getNodes() call ends up 
with NPE. Do you agree that this is a bug?

Cheers,
Jan

On Feb 4, 2013, at 9:43 AM, Jan Haderka <[email protected]> wrote:

> Hi,
> 
> I get NPE during call to node.getNodes() in JackRabbit 2.4.3. Not sure what 
> the cause is. 
> 
> The failing line is:
>        if (!data.getParentId().equals(parentId)) {
> 
> When error occurs, data.getParentId() return null. Could it be because item 
> in data is transient?
> Is this a bug in JackRabbit or should I not be allowed to iterate over 
> transient items?
> 
> Thanks for any insight,
> 
> Jan
> 
> 
> Stacktrace:
> java.lang.NullPointerException
>       at org.apache.jackrabbit.core.ItemManager.getNode(ItemManager.java:671)
>       at org.apache.jackrabbit.core.ItemManager.getNode(ItemManager.java:647)
>       at 
> org.apache.jackrabbit.core.LazyItemIterator.prefetchNext(LazyItemIterator.java:120)
>       at 
> org.apache.jackrabbit.core.LazyItemIterator.<init>(LazyItemIterator.java:104)
>       at 
> org.apache.jackrabbit.core.ItemManager.getChildNodes(ItemManager.java:755)
>       at org.apache.jackrabbit.core.NodeImpl$9.perform(NodeImpl.java:2175)
>       at org.apache.jackrabbit.core.NodeImpl$9.perform(NodeImpl.java:2171)
>       at 
> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
>       at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
>       at org.apache.jackrabbit.core.NodeImpl.getNodes(NodeImpl.java:2171)
> 
> Extra info:
> ItemManager (org.apache.jackrabbit.core.ItemManager@6bca3af1)
> Items in cache:
> Property:           
> 3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.magnolia.info/jcr/mgnl}created
>    /page/otherPar/mgnl:created 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.magnolia.info/jcr/mgnl}created)
> Property:           
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}uuid     
> /page/jcr:uuid 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}uuid)
> Property:           
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}createdBy    
>     /page/jcr:createdBy 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}createdBy)
> Property:           
> 3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}uuid     
> /page/otherPar/jcr:uuid 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}uuid)
> Node: transient f739840b-3501-4011-a57e-28b5c0566b28  
> f739840b-3501-4011-a57e-28b5c0566b28 (f739840b-3501-4011-a57e-28b5c0566b28)
> Property:           
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}mixinTypes   
>     /page/jcr:mixinTypes 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}mixinTypes)
> Property:           
> 3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}created  
> /page/otherPar/jcr:created 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}created)
> Property:           
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}created  
> /page/jcr:created 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}created)
> Property:           
> 3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}mixinTypes   
>     /page/otherPar/jcr:mixinTypes 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}mixinTypes)
> Property: transient 
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.magnolia.info/jcr/mgnl}created
>    /page/mgnl:created 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.magnolia.info/jcr/mgnl}created)
> Node:           3b76a3ce-76ef-4bbe-ae40-e24eb4354f75  /page/otherPar 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75)
> Node: transient b1aa30b9-d277-4186-80d2-6f84504ccaa6  /page 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6)
> Property:           
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}primaryType  
>     /page/jcr:primaryType 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.jcp.org/jcr/1.0}primaryType)
> Property: transient 
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.magnolia.info/jcr/mgnl}lastModified
>       /page/mgnl:lastModified 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.magnolia.info/jcr/mgnl}lastModified)
> Property: transient 
> b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.magnolia.info/jcr/mgnl}lastModifiedBy
>     /page/mgnl:lastModifiedBy 
> (b1aa30b9-d277-4186-80d2-6f84504ccaa6/{http://www.magnolia.info/jcr/mgnl}lastModifiedBy)
> Property:           
> 3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}createdBy    
>     /page/otherPar/jcr:createdBy 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}createdBy)
> Property:           
> 3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}primaryType  
>     /page/otherPar/jcr:primaryType 
> (3b76a3ce-76ef-4bbe-ae40-e24eb4354f75/{http://www.jcp.org/jcr/1.0}primaryType)
> Node:           cafebabe-cafe-babe-cafe-babecafebabe  / 
> (cafebabe-cafe-babe-cafe-babecafebabe)
> 
> ParentId:   b1aa30b9-d277-4186-80d2-6f84504ccaa6
> data:          f739840b-3501-4011-a57e-28b5c0566b28
> 
> 
> 
> 


Reply via email to