Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11715

ResourceResolver.map resolves same resource twice

    XMLWordPrintableJSON

Details

    Description

      While investigation repository access I found that a ResourceResolver.map() call invokes ResourceResolver.resolveInternal() twice for the same resource.

      See these parts of the call stack:

              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getAbsoluteResourceInternal(ResourceResolverImpl.java:901) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolveInternal(ResourceResolverImpl.java:727) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.mapping.ResourceMapperImpl.getAllMappings(ResourceMapperImpl.java:145) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.mapping.ResourceMapperImpl.getMapping(ResourceMapperImpl.java:73) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.map(ResourceResolverImpl.java:445) [org.apache.sling.resourceresolver:1.10.0]
      
              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolveInternal(ResourceResolverImpl.java:384) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolve(ResourceResolverImpl.java:256) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.mapping.ResourceMapperImpl.loadAliasesIfApplicable(ResourceMapperImpl.java:220) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.mapping.ResourceMapperImpl.getAllMappings(ResourceMapperImpl.java:147) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.mapping.ResourceMapperImpl.getMapping(ResourceMapperImpl.java:73) [org.apache.sling.resourceresolver:1.10.0]
              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.map(ResourceResolverImpl.java:445) [org.apache.sling.resourceresolver:1.10.0]
      

      In ResourceResolverMapperImpl.loadAliasesIfApplicable() a resolved resource is passed, and when no alias is encountered the same resource will be resolved again in line 220.

      Attachments

        Issue Links

          Activity

            People

              joerghoh Joerg Hoh
              joerghoh Joerg Hoh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: