Impossible to refer to same-name-siblings when doing internal redirect to 
another protocol
------------------------------------------------------------------------------------------

                 Key: SLING-1455
                 URL: https://issues.apache.org/jira/browse/SLING-1455
             Project: Sling
          Issue Type: Bug
          Components: JCR
    Affects Versions: JCR Resource 2.0.6
            Reporter: Vidar S. Ramdal
             Fix For: JCR Resource 2.0.8


Consider the following repository contents:

/etc/map/general-redirect
- sling:internalRedirect = protocol://$1
- sling:match = http/(.*)\.\d+

/etc/map/protocol
- sling:internalRedirect = /content

/content/localhost.80
/content/localhost.80/child
/content/localhost.80/child[2]

The domain mappings (under /etc/map) are then set up so that:
1) A request to http://localhost:8080 should internally redirect to 
protocol://localhost.80. This, again, causes the request to resolve to 
/content/localhost.80, which is what is intended.

2) Thus, a request to http://localhost:8080/child.html should resolve to 
/content/localhost.80/child.

Both 1) and 2) works as intended. However, when including indexes for same-name 
siblings, the resolution fails:
http://localhost:8080/child[2].html
.. causes a NPE: *ERROR* [0:0:0:0:0:0:0:1%0 [1269213415402] GET 
/child%5B2%5D.html HTTP/1.1] org.apache.sling.engine.impl.SlingMainServlet 
service: Uncaught Problem handling the request java.lang.NullPointerException
        at 
org.apache.sling.engine.impl.SlingHttpServletRequestImpl.getResource(SlingHttpServletRequestImpl.java:90)
        at 
org.apache.sling.servlets.resolver.internal.SlingServletResolver.getErrorResource(SlingServletResolver.java:368)
        at 
org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:259)

This is because resolution in JcrResourceResolver has failed when trying to 
construct a URL for the string protocol://localhost/child[2].html:
            try {
                URI uri = new URI(mappedPath[0]);
... throws a URISyntaxException because the string argument contains unescaped 
brackets (for [2]). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to