You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2016/12/09 14:08:58 UTC

[jira] [Comment Edited] (SLING-6383) Unexpected behavior with left curly bracket in resource resolution

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

Bertrand Delacretaz edited comment on SLING-6383 at 12/9/16 2:08 PM:
---------------------------------------------------------------------

It looks like the unexpected behavior happens at the Oak level. We have this code in our {{JcrItemResourceFactory}} class

{code}
if (session instanceof JackrabbitSession) {
  item = ((JackrabbitSession) session).getItemOrNull(path);
 }
{code}

And if that's called with path = "/libs/{sub/end.tidy.json" which does not exists, the {{getItemOrNull}} method returns an Item with path = /libs, which exists.

This is using the Sling trunk which uses Oak 1.5.13.

Steps to reproduce:
* Start the Sling launchpad/builder trunk 
* Set a Java breakpoint on the above line
* curl -D - http://localhost:8080/libs/%7Bsub.tidy.json 

The breakpoint is hit with path=/libs/{sub.tidy.json and the getItemOrNull method returns the /libs Node.







was (Author: bdelacretaz):
It looks like the unexpected behavior happens at the Oak level. We have this code in our {{JcrItemResourceFactory}} class

{code}
if (session instanceof JackrabbitSession) {
  item = ((JackrabbitSession) session).getItemOrNull(path);
 }
{code}

And if that's called with path = "/libs/{sub/end.tidy.json" which does not exists, the {{getItemOrNull}} method returns an Item with path = /libs, which exists.

This is using the Sling trunk which uses Oak 1.5.13.






> Unexpected behavior with left curly bracket in resource resolution
> ------------------------------------------------------------------
>
>                 Key: SLING-6383
>                 URL: https://issues.apache.org/jira/browse/SLING-6383
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>            Reporter: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: test.jsp
>
>
> The attached {{test.jsp}} script produces the below output, in which cases 4 to 7 are suprising.
> Given an existing resource R (/libs here) it looks like adding a sub-path to R's path which starts with a left curly bracket causes the resolver to return R instead of a non-existing resource. 
> The returned resource has the full path that was resolved, not R's path, but adapTo(Node.class) returns R's node.
> {code}
> 1 /libs
>   (sling:Folder)
>   JCR:/libs
> 2 /libs/sub
>   (sling:nonexisting)
> 3 /libs/sub/end
>   (sling:nonexisting)
> 4 /libs/{end
>   (sling:Folder)
>   JCR:/libs
> 5 /libs/{sub/end
>   (sling:Folder)
>   JCR:/libs
> 6 /libs/{sub/more/end
>   (sling:Folder)
>   JCR:/libs
> 7 /libs/{sub/end
>   (sling:Folder)
>   JCR:/libs
> 8 /libs/}sub/end
>   (sling:nonexisting)
> 9 /libs/{sub}/end
>   (sling:nonexisting)
> 10 /libs/sub/{end
>   (sling:nonexisting)
> 11 /libs/sub/}end
>   (sling:nonexisting)
> 12 /libs/sub/{end}
>   (sling:nonexisting)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)