From 8da5627c6c6339ceb54e141ee7d3ba2962d41a39 Mon Sep 17 00:00:00 2001 From: Rohit Pandey Date: Fri, 13 Dec 2019 18:43:53 +0530 Subject: [PATCH] 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 --- .../mvc/method/annotation/ExceptionHandlerExceptionResolver.java | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java index 2c4c264538..b01703aed7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java @@ -235,7 +235,6 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce * {@code HttpMessageConverter}. */ public void setResponseBodyAdvice(@Nullable List> responseBodyAdvice) { - this.responseBodyAdvice.clear(); if (responseBodyAdvice != null) { this.responseBodyAdvice.addAll(responseBodyAdvice); }