Skip to content

Commit

Permalink
Merge branch 'trunk' into OAK-11371
Browse files Browse the repository at this point in the history
  • Loading branch information
reschke committed Jan 10, 2025
2 parents 9bfa7b6 + 02fe3d1 commit 8f07a0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ private Iterable<? extends ChildNodeEntry> getChildNodeEntries(NodeState node, S
List<ChildNodeEntry> entries = new ArrayList<>(names.size());
for (String name : names) {
try {
entries.add(new MemoryChildNodeEntry(name, node.getChildNode(name)));
NodeState childNode = node.getChildNode(name);
if (childNode.exists()) {
entries.add(new MemoryChildNodeEntry(name, childNode));
}
} catch (Throwable t) {
if (catchExceptions) {
String message = "Cannot read node " + basePath + "/" + name + " : " + t.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.jackrabbit.oak.api.Type;
Expand All @@ -41,8 +40,11 @@ public void childOrder() throws Exception{
builder.child("a");
builder.child("b");
builder.child("c");
List<String> expectedOrder = Arrays.asList("a", "c", "b");
builder.setProperty(":childOrder", expectedOrder, Type.NAMES);
builder.child("d");
builder.setProperty(":childOrder", List.of("a", "c", "b", "d"), Type.NAMES);

// A removed child should not be included in the output
builder.getChildNode("c").remove();

NodeState state = builder.getNodeState();
String json = serialize(state);
Expand All @@ -60,7 +62,7 @@ public void childOrder() throws Exception{

} while (reader.matches(','));

assertEquals(expectedOrder, childNames);
assertEquals(List.of("a", "b", "d"), childNames);
}

private String serialize(NodeState nodeState){
Expand Down

0 comments on commit 8f07a0d

Please sign in to comment.