You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Julian Sedding (Jira)" <ji...@apache.org> on 2026/10/14 07:31:00 UTC
[jira] [Resolved] (SLING-13326) incorrect results from ResourceResolver.getParentResourceType() cache
[ https://issues.apache.org/jira/browse/SLING-13326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Sedding resolved SLING-13326.
------------------------------------
Resolution: Fixed
> incorrect results from ResourceResolver.getParentResourceType() cache
> ----------------------------------------------------------------------
>
> Key: SLING-13326
> URL: https://issues.apache.org/jira/browse/SLING-13326
> Project: Sling
> Issue Type: Bug
> Components: ResourceResolver
> Affects Versions: Resource Resolver 2.0.0, Resource Resolver 1.12.16
> Reporter: Julian Sedding
> Assignee: Joerg Hoh
> Priority: Blocker
> Fix For: Resource Resolver 2.0.8, Resource Resolver 1.12.20
>
>
> The cache for {{ResourceResolver.getParentResourceType()}} calls uses {{Resource.getPath()}} as the key. However, it is commonplace, e.g. in Sling Models, to wrap/decorate a resource in order to override its resource-type. In this case, the path does not change, but the result of {{ResourceResolver.getParentResourceType()}} needs to reflect the changed resource-type.
> This can lead to endless recursion for a scenario similar to the following
> {noformat}
> # given the following resource-type hierarchy
> # foo/pages/special
> # \_ foo/pages/base
> # \_ generic/pages/page
> ResourceResolver rr
> Resource resource = Resource(/content/foo, foo/pages/special)
> assert rr.getParentResourceType(resource) == foo/pages/base
> Resource decorated = Resource(resource, foo/pages/base)
> assert rr.getParentResourceType(resource) == generic/pages/page // fails, because it is foo/pages/base{noformat}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)