[
https://issues.apache.org/jira/browse/SLING-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Klimetschek updated SLING-2099:
-----------------------------------------
Attachment: SLING-2099.patch
Simple patch, avoiding the log for servlet == null.
One could also log something different if no servlet was found, but that is
done by both calling methods anyway.
> NPE in SlingServletResolver.resolveServlet() for no matches if debug logging
> enabled
> ------------------------------------------------------------------------------------
>
> Key: SLING-2099
> URL: https://issues.apache.org/jira/browse/SLING-2099
> Project: Sling
> Issue Type: Bug
> Components: Servlets
> Affects Versions: Servlets Resolver 2.1.0
> Reporter: Alexander Klimetschek
> Priority: Minor
> Attachments: SLING-2099.patch
>
>
> Steps to reproduce:
> - enable debug logging for org.apache.sling.servlets.resolver
> - call SlingServletResolver.resolveServlet(rr, "doesnotexist.jsp")
> => results in this stacktrace:
> Caused by: java.lang.NullPointerException
> at
> org.apache.sling.api.request.RequestUtil.getServletName(RequestUtil.java:129)
> at
> org.apache.sling.servlets.resolver.internal.SlingServletResolver.resolveServlet(SlingServletResolver.java:360)
> at
> org.apache.sling.servlets.resolver.internal.SlingServletResolver.resolveServlet(SlingServletResolver.java:320)
> The problem is in the internal resolveServlet(), where in the servlet == null
> and log.isDebugEnabled() case, RequestUtil.getServletName(servlet) is called,
> which throws for a null argument.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira