joerghoh commented on a change in pull request #43: URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/43#discussion_r604875654
########## File path: src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java ########## @@ -1046,37 +1051,57 @@ public String getParentResourceType(final String resourceType) { public boolean isResourceType(final Resource resource, final String resourceType) { boolean result = false; if ( resource != null && resourceType != null ) { - // Check if the resource is of the given type. This method first checks the - // resource type of the resource, then its super resource type and continues - // to go up the resource super type hierarchy. - if (ResourceTypeUtil.areResourceTypesEqual(resourceType, resource.getResourceType(), factory.getSearchPath())) { - result = true; - } else { - Set<String> superTypesChecked = new HashSet<>(); - String superType = this.getParentResourceType(resource); - while (!result && superType != null) { - if (ResourceTypeUtil.areResourceTypesEqual(resourceType, superType, factory.getSearchPath())) { - result = true; - } else { - superTypesChecked.add(superType); - superType = this.getParentResourceType(superType); - if (superType != null && superTypesChecked.contains(superType)) { - throw new SlingException("Cyclic dependency for resourceSuperType hierarchy detected on resource " + resource.getPath(), null); - } - } - } + + // Check if the result is already available from cache + String3Tupel key = new String3Tupel(resource.getResourceType(),resource.getResourceSuperType(), resourceType); Review comment: I renamed the class. We don't need any getters, as it is just used as a key in the map. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org