jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Edelson <justinedel...@gmail.com>
Subject Re: Always getting exception:Session has pending changes
Date Wed, 15 Sep 2010 13:12:32 GMT
Your code sequence is wrong. You need to:

checkout
modify
save
checkin

(repeat)

On 9/15/10 5:11 AM, shahid.khan wrote:
> 
> Hi All, 
> 
> I am facing problem when doing checkin after a checkout of "mix:versionable"
> node. I am getting following exception at the time of checkin: 
> InvalidItemStateException: Unable to perform operation. Session has pending
> changes. 
>         at
> org.apache.jackrabbit.core.ItemValidator.checkCondition(ItemValidator.java:296) 
>         at
> org.apache.jackrabbit.core.ItemValidator.checkModify(ItemValidator.java:277) 
>         at
> org.apache.jackrabbit.core.VersionManagerImpl.getNodeState(VersionManagerImpl.java:520)

>         at
> org.apache.jackrabbit.core.VersionManagerImpl.getNodeState(VersionManagerImpl.java:505)

>         at
> org.apache.jackrabbit.core.VersionManagerImpl.checkin(VersionManagerImpl.java:102) 
>         at
> org.apache.jackrabbit.core.VersionManagerImpl.checkin(VersionManagerImpl.java:88) 
>         at org.apache.jackrabbit.core.NodeImpl.checkin(NodeImpl.java:3162) 
>         at
> org.apache.jackrabbit.webdav.simple.DavResourceImpl.addMember(DavResourceImpl.java:581)

>         at
> org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.doPut(AbstractWebdavServlet.java:566)

> 
> My code is as below: 
> 
>             Node fileNode=null; 
>             try{ 
>             fileNode= node.getNode(ctx.getSystemId()); 
>             }catch(PathNotFoundException e){ 
>             
>             } 
>             if(fileNode != null && fileNode.isNodeType("mix:versionable")){ 
>             fileNode.checkout(); 
>             } 
>             if (!config.getIOManager().importContent(ctx, member)) { 
>                 // any changes should have been reverted in the importer 
>                 throw new
> DavException(DavServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); 
>             } 
>             // persist changes after successful import 
>             if(fileNode != null && fileNode.isNodeType("mix:versionable")){ 
>             
>             fileNode.checkin(); 
>             } 
>             Session session=node.getSession(); 
>             session.save(); 
> 
> 
> I am modifying a files content and if it is versionable node then I am
> trying to create a new version but it always says session has pending
> changes while I am not performing any changes after checkin. 
> 
> Thanks in advance for any help. 
> 
> Thanks & Regards 
> Shahid K. 
> 


Mime
View raw message