Affects: 5.3.31
Happening in the phrase of writing object returned by endpoint(controller method) to the OutputStream of response body.
When the ObjectWriter#writeValue(JsonGenerator g, Object value) throw exception, eg: due to a null key of HashMap:
In such case, theObjectWriter#close method will be called( invoke by the try-resources statement), it will write the intermediate corrupted result to the OutputStream.
Whereafter, the DispatcherServlet#processDispatchResult method will trigger HandlerExceptionResolver, which will cause a secondary writing.
Stand in the perspective of the client, a corrupted response they will get.
{"success":true,"data":{}}{"success":false}
The {"success":true,"data":{}} written by ObjectWriter#close, and the {"success":false} written by HandlerExceptionResolver.
Affects: 5.3.31
Happening in the phrase of writing object returned by endpoint(controller method) to the
OutputStreamof response body.When the
ObjectWriter#writeValue(JsonGenerator g, Object value)throw exception, eg: due to a null key of HashMap:In such case, the
ObjectWriter#closemethod will be called( invoke by the try-resources statement), it will write the intermediate corrupted result to theOutputStream.Whereafter, the
DispatcherServlet#processDispatchResultmethod will triggerHandlerExceptionResolver, which will cause a secondary writing.Stand in the perspective of the client, a corrupted response they will get.
The
{"success":true,"data":{}}written byObjectWriter#close, and the{"success":false}written byHandlerExceptionResolver.