jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marlis Lamp (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-2912) VersionManager.restore fails with ItemExitsException although the removeExisting parameter is set to true
Date Thu, 10 Mar 2011 09:15:07 GMT
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


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

Mime
View raw message