You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:59:56 UTC

[sling-org-apache-sling-resourceresolver] 26/47: SLING-2521 - handling jcr:content child node case

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.resourceresolver-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit fcd45b882a27e6df1bd5c4980d78897e140c5cee
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Aug 29 01:47:56 2012 +0000

    SLING-2521 - handling jcr:content child node case
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver@1378422 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/resourceresolver/impl/mapping/MapEntries.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
index 533affe..e618311 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
@@ -484,14 +484,23 @@ public class MapEntries implements EventHandler {
                 continue;
             }
 
-            final String parentPath = resource.getParent().getPath();
+            final String resourceName;
+            final String parentPath;
+            if (resource.getName().equals("jcr:content")) {
+                final Resource containingResource = resource.getParent();
+                parentPath = containingResource.getParent().getPath();
+                resourceName = containingResource.getName();
+            } else {
+                parentPath = resource.getParent().getPath();
+                resourceName = resource.getName();
+            }
             Map<String, String> parentMap = map.get(parentPath);
             if (parentMap == null) {
                 parentMap = new HashMap<String, String>();
                 map.put(parentPath, parentMap);
             }
             for (final String alias : props.get(ResourceResolverImpl.PROP_ALIAS, String[].class)) {
-                parentMap.put(alias, resource.getName());
+                parentMap.put(alias, resourceName);
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.