From c49605cd7b6a76168738019a21632bd64b2634ed Mon Sep 17 00:00:00 2001 From: Lopfest Date: Wed, 5 Aug 2020 19:15:10 +0200 Subject: [PATCH] Fix include exception handling in DefaultErrorAttributes This commit fixes a problem with the handling of the includeException field in DefaultErrorAttributes. See gh-22750 --- .../boot/web/reactive/error/DefaultErrorAttributes.java | 2 +- .../boot/web/servlet/error/DefaultErrorAttributes.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java index 040fdadd69..6210c5ce8c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java @@ -86,7 +86,7 @@ public class DefaultErrorAttributes implements ErrorAttributes { @Override public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { Map errorAttributes = getErrorAttributes(request, options.isIncluded(Include.STACK_TRACE)); - if (this.includeException != null) { + if (Boolean.TRUE.equals(this.includeException)) { options = options.including(Include.EXCEPTION); } if (!options.isIncluded(Include.EXCEPTION)) { 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 5ec93af76c..d1c991cf4b 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 @@ -108,7 +108,7 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException @Override public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { Map errorAttributes = getErrorAttributes(webRequest, options.isIncluded(Include.STACK_TRACE)); - if (this.includeException != null) { + if (Boolean.TRUE.equals(this.includeException)) { options = options.including(Include.EXCEPTION); } if (!options.isIncluded(Include.EXCEPTION)) {