You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Eric Norman (Jira)" <ji...@apache.org> on 2023/02/26 21:33:00 UTC

[jira] [Updated] (SLING-11789) MockNode#orderBefore incorrectly removes commonly prefixed child nodes

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

Eric Norman updated SLING-11789:
--------------------------------
    Fix Version/s: Testing JCR Mock 1.6.4
                       (was: Testing JCR Mock 1.6.2)

> MockNode#orderBefore incorrectly removes commonly prefixed child nodes
> ----------------------------------------------------------------------
>
>                 Key: SLING-11789
>                 URL: https://issues.apache.org/jira/browse/SLING-11789
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>            Reporter: Eric Norman
>            Assignee: Eric Norman
>            Priority: Major
>             Fix For: Testing JCR Mock 1.6.4
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The MockNode#orderBefore implementation is using a simple "startsWith" check on path strings to find the items to move.  This will match too many items if the sibling nodes have names with a common prefix.
> For example, for the following scenario child10 should be ordered before child100, but what actually happens is both child10 and child100 get removed from the parent.
>  
> {code:java}
> Node foo = this.session.getRootNode().addNode("foo");
> foo.addNode("child100");
> foo.addNode("child10");
> foo.addNode("child1");
> foo.orderBefore("child10", "child100"); 
> {code}
> Expected:
> The "find all items matching the source" logic in MockSession#orderBefore should be changed to match paths that equal the source path exactly or starts with the source path with a trailing slash.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)