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 2006/10/06 11:38:23 UTC
[jira] Assigned: (JCR-586) Removing a mixin that adds a
same-name-sibling child node throws an ItemNotFoundException
[ http://issues.apache.org/jira/browse/JCR-586?page=all ]
Stefan Guggisberg reassigned JCR-586:
-------------------------------------
Assignee: Stefan Guggisberg
> Removing a mixin that adds a same-name-sibling child node throws an ItemNotFoundException
> -----------------------------------------------------------------------------------------
>
> Key: JCR-586
> URL: http://issues.apache.org/jira/browse/JCR-586
> Project: Jackrabbit
> Issue Type: Bug
> Components: nodetype, core
> Affects Versions: 1.0, 1.0.1, 1.1, 0.9
> Environment: Tested with trunk from 04-Oct-2006 (1.1)
> Reporter: Michael Daglian
> Assigned To: Stefan Guggisberg
> Priority: Minor
>
> Apologies in advance if this has previously been noted in JIRA or on the lists but I couldn't find anything. When removing a mixin that defines a same-name-sibling child an ItemNotFoundException is thrown due to child node indicies not being maintained. A similar method of NodeImpl (onRemove) recongnized this and amended to remove from the tail but the removeMixin also has this issue.
> Simple test reproduction:
> Types:
> [mix:foo] mixin
> + bar (nt:bar) multiple
>
> [nt:bar] > nt:unstructured, mix:referenceable
> Code:
> public class RemoveMixinTest extends AbstractServerTest {
> private static final String MIXIN = "mix:foo";
> private static final String CHILD = "bar";
> private static final String PTYPE = "nt:bar";
>
> public void testRemoveMixin() throws RepositoryException {
> Session session = getSession();
> Node root = session.getRootNode().addNode("root");
> root.addMixin(MIXIN);
>
> root.addNode(CHILD, PTYPE);
> root.addNode(CHILD, PTYPE);
> root.addNode(CHILD, PTYPE);
>
> session.save();
>
> for (NodeIterator it = root.getNodes(); it.hasNext(); ) {
> Node node = it.nextNode();
> System.out.println(node.getPath() + " : " + node.getUUID());
> }
>
> try {
> root.removeMixin(MIXIN);
> root.save();
> } catch (RepositoryException ex) {
> ex.printStackTrace();
> }
> }
> }
> Output:
> /root/bar : 0b09e0b4-0727-4194-978a-4eadfbf93fa8
> /root/bar[2] : 84d5e556-6f12-43fb-98e3-614bcf1f7bb7
> /root/bar[3] : 8db95029-df3b-4e26-affb-438de0206cf5
> javax.jcr.ItemNotFoundException: 8db95029-df3b-4e26-affb-438de0206cf5
> at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:463)
> at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:319)
> at org.apache.jackrabbit.core.NodeImpl.removeMixin(NodeImpl.java:1212)
> at org.apache.jackrabbit.core.NodeImpl.removeMixin(NodeImpl.java:2624)
> at com.ms.appmw.rcf.server.RemoveMixinTest.testRemoveMixin(RemoveMixinTest.java:48)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at msjava.base.testutils.junit3.MSTestCase.runTest(MSTestCase.java:203)
> at msjava.base.testutils.junit3.TestCaseTearDownEvenIfSetUpFails.runBare(TestCaseTearDownEvenIfSetUpFails.java:92)
> at msjava.base.testutils.junit3.MSTestCase.runBare(MSTestCase.java:170)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> The missing UUID for the last node is the one not found because upon removal of the second the index [2] is still valid. Thanks!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira