Fix ExceptionHandlerExceptionResolver.setResponseBodyAdvice behaviour

Prior to this commit, calling the `setResponseBodyAdvice` method would
clear all existing `ResponseBodyAdvice` instances present in the list
before adding provided one.
This behavior is inconsistent with the Javadoc and other
implementations.

This brings the method in line with the existing documentation.

See gh-24204
This commit is contained in:
Rohit Pandey 2019-12-13 18:43:53 +05:30 committed by Brian Clozel
parent da071c1fce
commit 8da5627c6c
1 changed files with 0 additions and 1 deletions

View File

@ -235,7 +235,6 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
* {@code HttpMessageConverter}.
*/
public void setResponseBodyAdvice(@Nullable List<ResponseBodyAdvice<?>> responseBodyAdvice) {
this.responseBodyAdvice.clear();
if (responseBodyAdvice != null) {
this.responseBodyAdvice.addAll(responseBodyAdvice);
}