joerghoh commented on code in PR #115:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/115#discussion_r1966719211


##########
src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java:
##########
@@ -1054,14 +1058,41 @@ public boolean hasChildren(Resource resource) {
     public String getParentResourceType(final Resource resource) {
         String resourceSuperType = null;
         if ( resource != null ) {
-            resourceSuperType = resource.getResourceSuperType();
-            if (resourceSuperType == null) {
-                resourceSuperType = 
this.getParentResourceType(resource.getResourceType());
+            if (getParentResourceTypeMap().containsKey(resource.getPath())) {
+                resourceSuperType = 
getParentResourceTypeMap().get(resource.getPath());
+            } else {
+                resourceSuperType = getParentResourceTypeInternal(resource);
+                getParentResourceTypeMap().put(resource.getPath(), 
resourceSuperType);

Review Comment:
   I don't think that this will work, because it lead to a recursive call:
   ``getPrentResourceType`` -> ``getParentResourceTypeInternal`` -> 
``getParentResourceType``
   
   and that as part of ``computeIfAbsent``  multiple keys are modified in the 
map returned by ``getParentResourceTypeMap()``, which can lead to a 
``ConcurrentModificationException``.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to