[
https://issues.apache.org/jira/browse/SLING-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13627677#comment-13627677
]
Alexander Klimetschek commented on SLING-2819:
----------------------------------------------
map() expects a path for the 2nd argument, so I think it should simply throw an
IllegalArgumentException "not a path" in case uri.getPath() returns null or
simply return the original string unmodified. Depending on what we want.
> NPE in ResourceResolverImpl.mangleNamespaces when attempting to map
> http://example.com
> --------------------------------------------------------------------------------------
>
> Key: SLING-2819
> URL: https://issues.apache.org/jira/browse/SLING-2819
> Project: Sling
> Issue Type: Bug
> Components: JCR
> Affects Versions: Resource Resolver 1.0.4
> Reporter: Bertrand Delacretaz
> Assignee: Bertrand Delacretaz
> Priority: Minor
>
> The following JSP script (used as foo.jsp in the below example) throws an NPE
> with the current launchpad/builder which uses
> org.apache.sling.resourceresolver 1.0.5.SNAPSHOT:
> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
> <sling:defineObjects/>
> <%= resource.getResourceResolver().map(request, "http://example.com") %>
> Full failure scenario:
> export P=8080
> curl -u admin:admin -Fsling:resourceType=foo http://localhost:$P/tmp/foo
> curl -u admin:admin -XMKCOL http://localhost:$P/apps/foo
> curl -u admin:admin -T foo.jsp http://localhost:$P/apps/foo/foo.jsp
> curl -u admin:admin http://localhost:$P/tmp/foo.html
> The last request causes java.lang.NullPointerException
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.mangleNamespaces(ResourceResolverImpl.java:969)
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.map(ResourceResolverImpl.java:524)
> at org.apache.jsp.apps.foo.foo_jsp._jspService(foo_jsp.java:90)
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira