From f15067a1247833e4123044944fe3435488586573 Mon Sep 17 00:00:00 2001 From: Sonia Zorba <sonia.zorba@inaf.it> Date: Wed, 19 May 2021 15:57:32 +0200 Subject: [PATCH] Fixed Spring deprecated method in ErrorController --- .../java/it/inaf/oats/vospace/exception/ErrorController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/inaf/oats/vospace/exception/ErrorController.java b/src/main/java/it/inaf/oats/vospace/exception/ErrorController.java index 9effe8d..17d2091 100644 --- a/src/main/java/it/inaf/oats/vospace/exception/ErrorController.java +++ b/src/main/java/it/inaf/oats/vospace/exception/ErrorController.java @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController; +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,7 +28,8 @@ public class ErrorController extends AbstractErrorController { @RequestMapping(produces = MediaType.TEXT_XML_VALUE) public void errorText(HttpServletRequest request, HttpServletResponse response) throws Exception { - Map<String, Object> errors = super.getErrorAttributes(request, true); + ErrorAttributeOptions options = ErrorAttributeOptions.of(ErrorAttributeOptions.Include.MESSAGE); + Map<String, Object> errors = super.getErrorAttributes(request, options); response.setContentType("text/plain;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); String errorMessage = (String) errors.get("message"); -- GitLab