From 254ab55476c937eb674a285a7aea54e1337ebfa8 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 27 Oct 2014 11:08:53 +0000 Subject: [PATCH] Re-arrange priority of error message --- .../boot/autoconfigure/web/DefaultErrorAttributes.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java index 821c0a9fef..85ac4f85ba 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java @@ -75,7 +75,7 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException private void storeErrorAttributes(HttpServletRequest request, Exception ex) { request.setAttribute(ERROR_ATTRIBUTE, ex); - + } @Override @@ -121,9 +121,8 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException addStackTrace(errorAttributes, error); } } - if (error==null || errorAttributes.get("message")==null) { - Object message = getAttribute(requestAttributes, - "javax.servlet.error.message"); + Object message = getAttribute(requestAttributes, "javax.servlet.error.message"); + if (message != null || errorAttributes.get("message") == null) { errorAttributes.put("message", message == null ? "No message available" : message); }