You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2026/01/29 11:39:03 UTC
(jackrabbit-filevault) branch master updated: JCRVLT-839: Unconditional child node iteration in AggregateImpl.walk() (#413)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
The following commit(s) were added to refs/heads/master by this push:
new ff98510e JCRVLT-839: Unconditional child node iteration in AggregateImpl.walk() (#413)
ff98510e is described below
commit ff98510e55c4524a296b0c0e13f7f568ded4b6e7
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Thu Jan 29 12:38:58 2026 +0100
JCRVLT-839: Unconditional child node iteration in AggregateImpl.walk() (#413)
---
.../jackrabbit/vault/fs/impl/AggregateImpl.java | 24 ++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/AggregateImpl.java b/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/AggregateImpl.java
index 525660fb..c560e6db 100644
--- a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/AggregateImpl.java
+++ b/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/AggregateImpl.java
@@ -462,7 +462,9 @@ public class AggregateImpl implements Aggregate {
aggregateWalkListener.onChildren(node, depth);
boolean hasOrderableChildNodes = node.getPrimaryNodeType().hasOrderableChildNodes();
- Iterable<Node> children = new NodeIterable(node.getNodes());
+ NodeIterator nit =
+ hasOrderableChildNodes ? node.getNodes() : getNodeIteratorFor(node, mgr.getWorkspaceFilter());
+ Iterable<Node> children = new NodeIterable(nit);
// if children not ordered: find included children, sort alphabetically
if (!hasOrderableChildNodes) {
@@ -820,10 +822,18 @@ public class AggregateImpl implements Aggregate {
}
}
+ /**
+ * Given a node and the workspace filter, tries to return a minimal node iterator, only containing the child nodes
+ * which really need to be visisted
+ * @param node
+ * @param filter
+ * @return "optimal" iterator
+ * @throws RepositoryException
+ */
private static NodeIterator getNodeIteratorFor(Node node, WorkspaceFilter filter) throws RepositoryException {
Set<String> childNamesOfInterest = filter.getDirectChildNamesTowardsFilterRoots(node.getPath());
- log.debug("childNamesOfInterest for {} -> {}", node.getPath(), childNamesOfInterest);
+ log.debug("getNodeIteratorFor: childNamesOfInterest for {} -> {}", node.getPath(), childNamesOfInterest);
NodeIterator nIter = null;
@@ -838,20 +848,22 @@ public class AggregateImpl implements Aggregate {
children.add(node.getNode(name));
} catch (PathNotFoundException ignored) {
// go on
- log.debug("Node not found in {}: {}, skipping...", node.getPath(), name);
+ log.debug("getNodeIteratorFor: node not found in {}: {}, skipping...", node.getPath(), name);
}
}
- log.debug("iterating over filter-supplied children: {}", children);
+ log.debug("getNodeIteratorFor: iterating over filter-supplied children: {}", children);
nIter = new NodeIteratorAdapter(children);
} catch (Exception ex) {
- log.debug("Exception while retrieving child nodes, falling back to simple iteration.", ex);
+ log.debug(
+ "getNodeIteratorFor: exception while retrieving child nodes, falling back to simple iteration.",
+ ex);
}
}
// otherwise (unknown or exception while getting nodes) fallback to classic child node iteration
if (nIter == null) {
- log.debug("iterating over all child nodes of: {}", node.getPath());
+ log.debug("getNodeIteratorFor: iterating over all child nodes of: {}", node.getPath());
nIter = node.getNodes();
}