[
https://issues.apache.org/jira/browse/SLING-921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Felix Meschberger updated SLING-921:
------------------------------------
Affects Version/s: API 2.0.2
> SlingSafeMethodsServlet swallows ClassCastExceptions
> ----------------------------------------------------
>
> Key: SLING-921
> URL: https://issues.apache.org/jira/browse/SLING-921
> Project: Sling
> Issue Type: Improvement
> Components: API
> Affects Versions: API 2.0.2
> Reporter: Alexander Klimetschek
> Assignee: Felix Meschberger
> Priority: Minor
> Fix For: API 2.0.4
>
> Attachments: SLING-921.patch
>
>
> SlingSafeMethodsServlet.service(ServletRequest req, ServletResponse res)
> tries to cast request & response objects to Sling's specific request &
> response interfaces. Therefore it catches a ClassCastException for those
> (seldom) cases where the servlet is erroneously used in a non-Sling
> environment and throws a ServletException in that case with the message "Not
> a Sling HTTP request/response".
> But this also swallows class-cast exceptions thrown inside custom servlets
> that inherit from SlingSafeMethodsServlet. The stacktrace is lost and the
> error message is wrong in this case.
> This can be fixed by doing an instanceof check instead of the try/catch block.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.