From 157df861f94dd7244a505c479bf6ba4ae8f1bf41 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 5 Jul 2019 07:07:33 +0100 Subject: [PATCH] Do not warn also if cause is re-thrown Closes gh-23233 --- .../method/annotation/ExceptionHandlerExceptionResolver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 f3c403e7bbe..da25c2a1fed 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 @@ -407,9 +407,9 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce } } catch (Throwable invocationEx) { - // Any other than the original exception is unintended here, + // Any other than the original exception (or its cause) is unintended here, // probably an accident (e.g. failed assertion or the like). - if (invocationEx != exception && logger.isWarnEnabled()) { + if (invocationEx != exception && invocationEx != exception.getCause() && logger.isWarnEnabled()) { logger.warn("Failure in @ExceptionHandler " + exceptionHandlerMethod, invocationEx); } // Continue with default processing of the original exception...