[
https://issues.apache.org/jira/browse/QPID-7719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15959137#comment-15959137
]
Alex Rudyy commented on QPID-7719:
----------------------------------
The test failed because instance of {{ServerScopedRuntimeException}}
({{StoreException}} to be precise) was thrown on opening of created {{Virtual
Host}}. Such exceptions are considered to be fatal. Thus, no handling is
implemented inside of {{RestServlet}}. The {{ServerScopedRuntimeExceptions}}
are handled inside of {{ExceptionHandlingFilter}} by invoking method
{{#uncaughtException}} of {{Thread.getDefaultUncaughtExceptionHandler()}}. When
{{Thread.UncaughtExceptionHandler}} ignores exception, status code {{200}} is
returned, as there is no code to explicitly set response code to {{500}}. Test
{{Thread.UncaughtExceptionHandler}} preserves and logs the exception. As
result, an execution is returned to servlet layer without sending any error to
the requester.
It seems a test issue. However, we can modify {{ExceptionHandlingFilter}} to
send status code {{500}} after control is returned from
{{Thread.UncaughtExceptionHandler}} back to test. That should make broker
behaviour more correct.
> [Java Broker] Set response code to 500 when unexpected error occurs during
> REST call
> -------------------------------------------------------------------------------------
>
> Key: QPID-7719
> URL: https://issues.apache.org/jira/browse/QPID-7719
> Project: Qpid
> Issue Type: Bug
> Components: Java Broker
> Reporter: Lorenz Quack
> Attachments:
> TEST-org.apache.qpid.systest.rest.VirtualHostRestTest.testCreateProvidedVirtualHost.txt
>
>
> Currently if there is an unhandled exception in the REST layer we do not set
> a error response code. The servlet ends up returning 200 which is clearly
> incorrect.
> we should set the error code to 500 and ideally return a JSON error message.
> The code in question is the final {{else}} block in
> {{RestServlet#setResponseStatus}} (~line 960).
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]