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

Felix Meschberger commented on SLING-215:
-----------------------------------------

This is probably an issue in 
org.apache.sling.servlet.resolver.helper.PathSupport.getScriptBaseName, where 
the condition

  (HttpConstants.METHOD_GET.equalsIgnoreCase(methodName)
            || HttpConstants.METHOD_HEAD.equalsIgnoreCase(methodName)
            && extension != null && extension.length() > 0)

is check and the "baseName" is intended to be set to the extension name unless 
the extension name is null or empty.

It looks like a evaluation order issue in that the || part must be correctly 
parenthesized:

  ((HttpConstants.METHOD_GET.equalsIgnoreCase(methodName)
            || HttpConstants.METHOD_HEAD.equalsIgnoreCase(methodName))
            && extension != null && extension.length() > 0)


WDYT ?

> NPE in servlet resolving
> ------------------------
>
>                 Key: SLING-215
>                 URL: https://issues.apache.org/jira/browse/SLING-215
>             Project: Sling
>          Issue Type: Bug
>          Components: ServletResolver
>            Reporter: Carsten Ziegeler
>
> When invoking a path without extension like 
> http://localhost:8080/sling1/cms/siteadmin (sling1 is the webapp context, and 
> cms/siteadmin is a node in the repository)
> I get the following error
> java.lang.NullPointerException
>       java.lang.String.startsWith(String.java:1252)
>       java.lang.String.startsWith(String.java:1281)
>       
> org.apache.sling.servlet.resolver.SlingServletResolver.getServletAt(SlingServletResolver.java:339)
>       
> org.apache.sling.servlet.resolver.SlingServletResolver.resolveServlet(SlingServletResolver.java:145)
>       
> org.apache.sling.core.impl.request.RequestData.init(RequestData.java:156)
>       
> org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:249)
>       
> org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:172)
>       
> org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
>       
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:109)
>       
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:75)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>       
> org.apache.sling.launcher.webapp.SlingServlet.service(SlingServlet.java:194)

-- 
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