[ 
https://issues.apache.org/jira/browse/SLING-4943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Konrad Windszus updated SLING-4943:
-----------------------------------
    Description: 
Currently if instantiating a {{ResourceNotFoundException}} with both a resource 
path and a message only the message is given out. That is e.g. a problem in 
{{DefaultGetServlet}} 
(https://github.com/apache/sling/blob/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultGetServlet.java#L218).
That leads to exceptions like this in the log
{code}
...
org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)
        at 
org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:322)
        at 
org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:216)
        at 
org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:103)
        at 
... 
Caused by: org.apache.sling.api.resource.ResourceNotFoundException: No resource 
found
        at 
org.apache.sling.servlets.get.impl.DefaultGetServlet.doGet(DefaultGetServlet.java:219)
        at 
org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:269)
        at 
org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
        at 
org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
        at 
org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533)
        at 
org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
        at 
org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
        at 
org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
...
{code}
You basically have no clue which resource path was requested (especially if the 
request was issued through request dispatching. Therefore I propose to always 
include the resource path in the message given out by {{getMessage()}} or 
{{getLocalizedMessage()}}

  was:
Currently if instantiating a {{ResourceNotFoundException}} with both a resource 
path and a message only the message is given out. That is e.g. a problem in 
{{DefaultGetServlet}} 
(https://github.com/apache/sling/blob/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultGetServlet.java#L218).
That leads to exceptions like this in the log
{code}
...
org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)
        at 
org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:322)
        at 
org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:216)
        at 
org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:103)
        at 
... 
Caused by: org.apache.sling.api.resource.ResourceNotFoundException: No resource 
found
        at 
org.apache.sling.servlets.get.impl.DefaultGetServlet.doGet(DefaultGetServlet.java:219)
        at 
org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:269)
        at 
org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
        at 
org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
        at 
org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533)
        at 
org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
        at 
org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
        at 
org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
...
{code}
You basically have no clue which resource path was requested (especially if the 
request was issued through request dispatching. Therefore I propose to always 
include the resource path in the message given out by {{getMessage()}} or 
{{getLocalizedMessage()}


> ResourceNotFoundException: Include resource path in the getMessage() method
> ---------------------------------------------------------------------------
>
>                 Key: SLING-4943
>                 URL: https://issues.apache.org/jira/browse/SLING-4943
>             Project: Sling
>          Issue Type: Bug
>          Components: API
>    Affects Versions: API 2.9.0
>            Reporter: Konrad Windszus
>             Fix For: API 2.10.0
>
>
> Currently if instantiating a {{ResourceNotFoundException}} with both a 
> resource path and a message only the message is given out. That is e.g. a 
> problem in {{DefaultGetServlet}} 
> (https://github.com/apache/sling/blob/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultGetServlet.java#L218).
> That leads to exceptions like this in the log
> {code}
> ...
> org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)
>       at 
> org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:322)
>       at 
> org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:216)
>       at 
> org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:103)
>       at 
> ... 
> Caused by: org.apache.sling.api.resource.ResourceNotFoundException: No 
> resource found
>       at 
> org.apache.sling.servlets.get.impl.DefaultGetServlet.doGet(DefaultGetServlet.java:219)
>       at 
> org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:269)
>       at 
> org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
>       at 
> org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
>       at 
> org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533)
>       at 
> org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
>       at 
> org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
>       at 
> org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
> ...
> {code}
> You basically have no clue which resource path was requested (especially if 
> the request was issued through request dispatching. Therefore I propose to 
> always include the resource path in the message given out by {{getMessage()}} 
> or {{getLocalizedMessage()}}



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

Reply via email to