You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "angela (JIRA)" <ji...@apache.org> on 2013/02/06 20:39:12 UTC

[jira] [Commented] (OAK-612) Calling addNode on a node that has orderable child nodes violates specification

    [ https://issues.apache.org/jira/browse/OAK-612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13572726#comment-13572726 ] 

angela commented on OAK-612:
----------------------------

just had another look at the implementation and found that this is might be due
to the way the Tree is defined to keep the order of children... at least Tree#orderBefore
states:

{quote}
[...] Calling this method for the first time on this {@code Tree} or any of its siblings will 
persist the current order of siblings and maintain it from this point on.
{quote}

if that was true it would mean the whenever a Node has orderable child nodes it
has to call orderBefore on one of the trees in order to make the child list
stable... and it would look rather odd to me. orderable child nodes is a characteristic
that is effective whenever a node has primary node type that "hasOrderableChildNodes" 
... that characteristic not 'created' upon the first reorder operation.
                
> Calling addNode on a node that has orderable child nodes violates specification
> -------------------------------------------------------------------------------
>
>                 Key: OAK-612
>                 URL: https://issues.apache.org/jira/browse/OAK-612
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> it seems to me that the current behavior of Node.addNode for a node that 
> has orderable child nodes violates the specification (section 23.3):
> {quote}
> 23.3 Adding a New Child Node
> When a child node is added to a node that has orderable child nodes
> it is added to the end of the list.
> {quote}
> however, the following test will fail:
> {code}
> @Test
>     public void testAddNode() throws Exception {
>         new TestContentLoader().loadTestContent(getAdminSession());
>         Session session = getAdminSession();
>         Node test = session.getRootNode().addNode("test", "test:orderableFolder");
>         assertTrue(test.getPrimaryNodeType().hasOrderableChildNodes());
>         Node n1 = test.addNode("a");
>         Node n2 = test.addNode("b");
>         session.save();
>         NodeIterator it = test.getNodes();
>         assertEquals("a", it.nextNode().getName());
>         assertEquals("b", it.nextNode().getName());
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira