You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2026/10/06 07:16:00 UTC

[jira] [Commented] (SLING-13326) incorrect results from ResourceResolver.getParentResourceType() cache

    [ https://issues.apache.org/jira/browse/SLING-13326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123640#comment-18123640 ] 

Stefan Seifert commented on SLING-13326:
----------------------------------------

a lot of our projects are also affected by the introduction of SLING-12244.

more or less all projects using [https://wcm.io/wcm/core-components/] as thin layout over the AEM core components are broken with the introduction of this caching layer - all AEMaaCS versions that ship with 1.12.18 are affected (starting with release 2026.9.28187.20260911T134704Z-260800)

i've prepared a backport of your PR to the 1.x branch: [https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/237]

currently, that fix looks promising, we will test it with more projects.

> 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
>            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)