File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
main/java/org/apache/jackrabbit/oak/plugins/tree/impl
test/java/org/apache/jackrabbit/oak/security/authorization/evaluation Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 11package org .apache .jackrabbit .oak .plugins .tree .impl ;
22
33import java .util .ArrayList ;
4+ import java .util .Collections ;
45import java .util .HashSet ;
56import java .util .Iterator ;
67import java .util .List ;
@@ -41,7 +42,7 @@ public class OrderedChildnameIterator implements Iterator<String> {
4142 private Iterator <String > nonOrderedChildrenIterator = null ;
4243
4344 public OrderedChildnameIterator (Iterable <String > orderedChildren , Iterable <String > allChildren ) {
44- this .orderedChildren = orderedChildren .iterator ();
45+ this .orderedChildren = orderedChildren == null ? Collections . emptyIterator () : orderedChildren .iterator ();
4546 this .allChildren = allChildren .iterator ();
4647 nextResult = getNextElement ();
4748 }
Original file line number Diff line number Diff line change 2121import static org .junit .Assert .assertNull ;
2222import static org .junit .Assert .assertTrue ;
2323
24+ import java .util .ArrayList ;
2425import java .util .List ;
2526import java .util .Set ;
2627
3233import org .apache .jackrabbit .oak .commons .collections .SetUtils ;
3334import org .apache .jackrabbit .oak .plugins .tree .TreeConstants ;
3435import org .apache .jackrabbit .oak .spi .security .privilege .PrivilegeConstants ;
36+ import org .junit .Assert ;
3537import org .junit .Before ;
3638import org .junit .Test ;
3739
@@ -98,7 +100,11 @@ public void testChildOrderWithoutPropertyReadAccess() throws Exception {
98100 assertFalse (aTree .hasProperty (JcrConstants .JCR_PRIMARYTYPE ));
99101
100102 List <String > expected = List .of ("/a/bb" , "/a/b" );
101- Iterable <String > childPaths = IterableUtils .transform (aTree .getChildren (), input -> input .getPath ());
102- assertTrue (childPaths .toString (), IterableUtils .elementsEqual (expected , childPaths ));
103+
104+ // Collect actual paths into a list
105+ List <String > actual = new ArrayList <>();
106+ aTree .getChildren ().forEach ( c -> actual .add (c .getPath ()));
107+
108+ assertEquals ("Child order should be maintained" , expected , actual );
103109 }
104110}
You can’t perform that action at this time.
0 commit comments