From 46c47dcd296435f7175c3cb59eea844b389454c5 Mon Sep 17 00:00:00 2001 From: wuwen Date: Sun, 1 Aug 2021 12:42:16 +0800 Subject: [PATCH] Remove dead code in DefaultErrorAttributes See gh-27538 --- .../boot/web/servlet/error/DefaultErrorAttributes.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java index 8cb9e0af48..a02479760f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java @@ -36,7 +36,6 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; -import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.HandlerExceptionResolver; @@ -219,9 +218,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException if (error instanceof BindingResult) { return (BindingResult) error; } - if (error instanceof MethodArgumentNotValidException) { - return ((MethodArgumentNotValidException) error).getBindingResult(); - } return null; }