[ https://issues.apache.org/jira/browse/OAK-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13805653#comment-13805653 ]
Jukka Zitting commented on OAK-1118: ------------------------------------ What happens here is that the {{removeMixin}} call automatically removes all versioning properties and thus the link to the original version history. But since the {{addMixin}} call makes the node versionable again, the {{VersionEditor}} invoked during {{save}} interprets (based on the lack of a {{jcr:rootVersion}} property) that the node has been made newly versionable, and proceeds to re-initialize the version history (give it a new UUID, etc...). A better way to handle that case would be to re-connect the node to the already existing version history, like Jackrabbit 2.x does. > Removing and readding mix:versionable fails if node is referenceable > -------------------------------------------------------------------- > > Key: OAK-1118 > URL: https://issues.apache.org/jira/browse/OAK-1118 > Project: Jackrabbit Oak > Issue Type: Bug > Components: core, jcr > Reporter: angela > > removing mix:versionable from a referenceable node will fail with the > following exception: > {quote} > javax.jcr.nodetype.ConstraintViolationException: OakConstraint0022: > /testdata[nt:unstructured, mix:referenceable, mix:versionable]: Mandatory > property jcr:predecessors can not be removed > at > org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:220) > at > org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:207) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:471) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:334) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:399) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:396) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:128) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:117) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:396) > at > org.apache.jackrabbit.oak.jcr.nodetype.MixinTest.testRemoveAddMixVersionable2(MixinTest.java:134) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at > org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:464) > at > org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) > at org.junit.runner.JUnitCore.run(JUnitCore.java:157) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62) > Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: > OakConstraint0022: /testdata[nt:unstructured, mix:referenceable, > mix:versionable]: Mandatory property jcr:predecessors can not be removed > {quote} > the test: > {code} > @Test > public void testRemoveAddMixVersionable() throws Exception { > testRootNode.addMixin(mixReferenceable); > testRootNode.addMixin(mixVersionable); > superuser.save(); > String vhId = testRootNode.getVersionHistory().getUUID(); > testRootNode.removeMixin(mixVersionable); > testRootNode.addMixin(mixVersionable); > superuser.save(); > assertFalse(vhId.equals(testRootNode.getVersionHistory().getUUID())); > } > {code} > i am not totally sure what is going wrong here as works if the node is only > mix:versionable.... -- This message was sent by Atlassian JIRA (v6.1#6144)