From d1d953819ac9f0c0ece5160b96899030cabda46c Mon Sep 17 00:00:00 2001 From: lock14 Date: Fri, 11 Sep 2020 13:24:06 -0700 Subject: [PATCH] Allow other "timestamp" types in MVC error model Remove casting "timestamp" to `java.util.Date` in `ErrorMvcAutoConfiguration` as the cast is not necessary and it prevents other types (e.g. `java.time`) from being used. See gh-23256 --- .../web/servlet/error/ErrorMvcAutoConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java index 458fc3de8d..b214796aba 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java @@ -206,7 +206,7 @@ public class ErrorMvcAutoConfiguration { } response.setContentType(TEXT_HTML_UTF8.toString()); StringBuilder builder = new StringBuilder(); - Date timestamp = (Date) model.get("timestamp"); + Object timestamp = model.get("timestamp"); Object message = model.get("message"); Object trace = model.get("trace"); if (response.getContentType() == null) {