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/15 14:52:18 UTC

(jackrabbit-filevault) branch master updated: JCRVLT-831: For collection of namespace prefixes, avoid iterating over sibling nodes not contained in the filter(s) (#408)

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 6cb9fdf0 JCRVLT-831: For collection of namespace prefixes, avoid iterating over sibling nodes not contained in the filter(s) (#408)
6cb9fdf0 is described below

commit 6cb9fdf084595878f9ab7857ca44ca69790751f4
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Thu Jan 15 15:52:13 2026 +0100

    JCRVLT-831: For collection of namespace prefixes, avoid iterating over sibling nodes not contained in the filter(s) (#408)
    
    
    
    ---------
    
    Co-authored-by: Konrad Windszus <kw...@apache.org>
---
 .../org/apache/jackrabbit/vault/fs/impl/AggregateImpl.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 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 9e4b3a06..28b0e71b 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
@@ -645,12 +645,18 @@ public class AggregateImpl implements Aggregate {
                 addNamespace(prefixes, p);
             }
         }
-        for (NodeIterator iter = node.getNodes(); iter.hasNext(); ) {
+        boolean hasOrderableChildNodes = node.getPrimaryNodeType().hasOrderableChildNodes();
+        // use the node iterator optimized for the workspace filter if and only if the node is not orderable,
+        // in which case we still need to visit all sibling nodes, as their prefixes will be needed in the
+        // serialization (as empty nodes)
+        NodeIterator iter =
+                hasOrderableChildNodes ? node.getNodes() : getNodeIteratorFor(node, mgr.getWorkspaceFilter());
+        while (iter.hasNext()) {
             Node c = iter.nextNode();
             String relPath = parentPath + "/" + c.getName();
             if (includes(relPath)) {
                 loadNamespaces(prefixes, relPath, c);
-            } else if (node.getPrimaryNodeType().hasOrderableChildNodes()) {
+            } else if (hasOrderableChildNodes) {
                 addNamespace(prefixes, c.getName());
             }
         }