You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Stefan Guggisberg (JIRA)" <ji...@apache.org> on 2011/03/10 10:45:59 UTC

[jira] Resolved: (JCR-2912) VersionManager.restore fails with ItemExitsException although the removeExisting parameter is set to true

     [ https://issues.apache.org/jira/browse/JCR-2912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Guggisberg resolved JCR-2912.
------------------------------------

    Resolution: Duplicate

duplicate of JCR-2891

> VersionManager.restore fails with ItemExitsException although the removeExisting parameter is set to true
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2912
>                 URL: https://issues.apache.org/jira/browse/JCR-2912
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core, versioning
>    Affects Versions: 2.2.4
>            Reporter: Marlis Lamp
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> In some cases versionManager.restore(versionManager.getBaseVersion(jcrNode.getPath()), true); fails with the following stack trace:
> Caused by: javax.jcr.ItemExistsException: 22437573-07b6-4dcd-8819-31b2c98dbf9d/{http://my.namespace}mynode 
> 	at org.apache.jackrabbit.core.version.NodeStateEx.moveFrom(NodeStateEx.java:603) 
> 	at org.apache.jackrabbit.core.version.VersionManagerImplRestore.internalRestoreFrozen(VersionManagerImplRestore.java:561) 
> 	at org.apache.jackrabbit.core.version.VersionManagerImplRestore.internalRestore(VersionManagerImplRestore.java:294) 
> 	at org.apache.jackrabbit.core.version.VersionManagerImplRestore.internalRestore(VersionManagerImplRestore.java:240) 
> 	at org.apache.jackrabbit.core.VersionManagerImpl.access$1300(VersionManagerImpl.java:72) 
> 	at org.apache.jackrabbit.core.VersionManagerImpl$6.perform(VersionManagerImpl.java:247) 
> 	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200) 
> 	at org.apache.jackrabbit.core.VersionManagerImpl.perform(VersionManagerImpl.java:95) 
> 	at org.apache.jackrabbit.core.VersionManagerImpl.restore(VersionManagerImpl.java:221) 
> 	at org.apache.jackrabbit.core.VersionManagerImpl.restore(VersionManagerImpl.java:213)
> I've figured out that the restoration only fails if the reference comparison in VersionManagerImplRestore in line 557:
> if (restoredChild.getParentId() == state.getNodeId()) {
> fails, although restoredChild.getParendId().compareTo(state.getNodeId()) returns 0.
> Changing the comparison to:
> if (restoredChild.getParentId().compareTo(state.getNodeId()) == 0) {
> solves the problem. Could you please tell me if the NodeId comparison suffices in this case? If so, could you please fix it in the next jackrabbit version? Thank you! 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira