Incorrect AsyncRequestTimeoutException handling in ResponseEntityExceptionHandler #32644
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Affects: 6.1.5
Hello. I noticed that when using the RFC7807 error handler, the AsyncRequestTimeoutException is not handled correctly.
The
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
class handles this exception:however, the getBody() method in the exception itself always returns a new object:
Because of this, populating the fields in the
org.springframework.web.ErrorResponse#updateAndGetBody
method (that called fromorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler#handleExceptionInternal
) has no effect.Reproduction:
spring.mvc.problemdetails.enabled: true
.we expect to see a response like this:
but in fact the response is:
Suggestion
I guess it can be fixed in AsyncRequestTimeoutException like that:
Workaround
as a workaround, i overridden method
ru.wbbank.error.handler.starter.webmvc.controller.WBProblemDetailsExceptionHandler#handleAsyncRequestTimeoutException
.We create
problemDetail
manually, not by AsyncRequestTimeoutException:The text was updated successfully, but these errors were encountered: