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

Michael Bolz reassigned OLINGO-492:
-----------------------------------

    Assignee: Michael Bolz

> Custom ODataErrorCallback is not called when ODataServlet is used
> -----------------------------------------------------------------
>
>                 Key: OLINGO-492
>                 URL: https://issues.apache.org/jira/browse/OLINGO-492
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core
>    Affects Versions: V2 2.0.1
>            Reporter: Vitali Yarmolik
>            Assignee: Michael Bolz
>
> We have an OData service which has custom implementation of 
> {{ODataErrorCallback}} for service-specific error handling. In order to 
> remove CXF dependencies we decided to use the recently introduced 
> {{ODataServlet}} instead of {{CXFNonSpringJaxrsServlet}} in web.xml. After 
> that I noticed that our custom error callback is not called in some cases. 
> Looking into the source code of the library I can name the following reasons 
> for that:
> # When an instance of {{ODataException}} is thrown during the call of 
> {{ODataServiceFactory.createService(ODataContext)}} method, the exception is 
> caught in {{ODataServlet.handleRequest(HttpServletRequest, ODataHttpMethod, 
> HttpServletResponse)}} method. In this case, 
> {{org.apache.olingo.odata2.core.*servlet*.ODataExceptionWrapper}} class is 
> used for the exception handling. The problem is that this class does not use 
> the custom error callback implementation in its 
> {{wrapInExceptionResponse(Exception)}} method.
> # In case an exception other than {{ODataException}} is thrown in 
> {{ODataServlet.handleRequest(HttpServletRequest, ODataHttpMethod, 
> HttpServletResponse)}} method (e.g. RuntimeException or an 
> application-specific exception), it will not be caught in the 
> {{handleRequest}} method at all. As a result, the exception will be handled 
> by the web server and the HTTP response will not be formatted according to 
> the OData specification. Obviously, the custom OData error callback is not 
> called in this case either.
> The custom OData error callback is used fine in both the aforementioned 
> situations in case {{CXFNonSpringJaxrsServlet}} is specified in web.xml.



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

Reply via email to