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

Konrad Windszus edited comment on SLING-3730 at 7/3/14 2:30 PM:
----------------------------------------------------------------

I assume that under certain circumstances only the ResolutionPathInfo is set 
(https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L819)
 but not the ResolutionPath as it is in 
https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L869.
 It seems to me that the first option (checking the path directly) does not 
seem to be implemented correctly in ResourceResolverImpl.resolveInternal(), as 
it sets only ResolutionPathInfo but not ResolutionPath. Also there is a lot of 
duplicate code in the method.


was (Author: kwin):
I assume that under certain circumstances only the ResolutionPathInfo is set 
(https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L819)
 but not the ResolutionPath as it is in 
https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L869.
 To me the first option (checking the path directly) does not seem to be 
implemented correctly in ResourceResolverImpl.resolveInternal()

> MergedResource does not set the metadata "sling.resolutionPath" properly
> ------------------------------------------------------------------------
>
>                 Key: SLING-3730
>                 URL: https://issues.apache.org/jira/browse/SLING-3730
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Resource Merger 1.1.2
>            Reporter: Konrad Windszus
>            Priority: Critical
>         Attachments: rewriter-issue-1.0.zip
>
>
> This metadata is evaluated by calling: 
> SlingHttpServletRequest.getRequestPathInfo().getResourcePath() (you can see 
> how this field is initially set in 
> org.apache.sling.engine.impl.request.SlingRequestPathInfo, line 59). This is 
> e.g. the case in 
> org.apache.sling.rewriter.impl.ProcessorConfigurationImpl.match(ProcessorConfigurationImpl.java:411).
>  If it returns null like it does for MergedResources (due to that metadata 
> not being set) that leads easily to NPEs like in the example with the 
> SlingRewriter.
> According to the Javadocs of RequestPathInfo 
> (https://github.com/apache/sling/blob/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestPathInfo.java)
>  I would assume that getResourcePath() never returns null. For all the other 
> methods it is explicitly stated if they are expected to return null in some 
> cases. All the other Resources like SyntheticResource or JcrItemResource 
> already set that metadata in their constructor.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to