You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jo...@apache.org on 2022/10/11 09:08:05 UTC
[sling-org-apache-sling-jcr-resource] branch master updated: SLING-11614 avoid duplicate creation of child node iterator (#37)
This is an automated email from the ASF dual-hosted git repository.
joerghoh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git
The following commit(s) were added to refs/heads/master by this push:
new 131afd0 SLING-11614 avoid duplicate creation of child node iterator (#37)
131afd0 is described below
commit 131afd005cbb98731b1cf7cf0f4571fda78c16a5
Author: Jörg Hoh <jo...@users.noreply.github.com>
AuthorDate: Tue Oct 11 11:08:00 2022 +0200
SLING-11614 avoid duplicate creation of child node iterator (#37)
---
.../sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
index dba7f67..9371aa5 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
@@ -25,6 +25,7 @@ import java.util.Map;
import javax.jcr.Item;
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
+import javax.jcr.NodeIterator;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
@@ -217,15 +218,13 @@ class JcrNodeResource extends JcrItemResource<Node> { // this should be package
return null;
}
-
- // ---------- Descendable interface ----------------------------------------
-
@Override
@Nullable Iterator<Resource> listJcrChildren() {
try {
- if (getNode().hasNodes()) {
+ NodeIterator iter = getNode().getNodes();
+ if (iter.hasNext()) {
return new JcrNodeResourceIterator(getResourceResolver(), path, version,
- getNode().getNodes(), this.helper, null);
+ iter, this.helper, null);
}
} catch (final RepositoryException re) {
LOGGER.error("listChildren: Cannot get children of " + this, re);