Skip to content

Commit c4f653e

Browse files
committed
Upgrade to Jackson 2.6.3
Closes gh-4170
1 parent f6b59fb commit c4f653e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Locale;
2424
import java.util.Map;
2525
import java.util.Map.Entry;
26+
import java.util.TimeZone;
2627

2728
import com.fasterxml.jackson.annotation.JsonCreator;
2829
import com.fasterxml.jackson.databind.Module;
@@ -206,7 +207,16 @@ private void configureDateFormat(Jackson2ObjectMapperBuilder builder) {
206207
(DateFormat) BeanUtils.instantiateClass(dateFormatClass));
207208
}
208209
catch (ClassNotFoundException ex) {
209-
builder.dateFormat(new SimpleDateFormat(dateFormat));
210+
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
211+
// Since Jackson 2.6.3 we always need to set a TimeZone (see gh-4170)
212+
// If none in our properties fallback to the Jackson's default
213+
TimeZone timeZone = this.jacksonProperties.getTimeZone();
214+
if (timeZone == null) {
215+
timeZone = new ObjectMapper().getSerializationConfig()
216+
.getTimeZone();
217+
}
218+
simpleDateFormat.setTimeZone(timeZone);
219+
builder.dateFormat(simpleDateFormat);
210220
}
211221
}
212222
}

spring-boot-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<httpclient.version>4.5.1</httpclient.version>
8787
<httpcore.version>4.4.4</httpcore.version>
8888
<infinispan.version>8.0.1.Final</infinispan.version>
89-
<jackson.version>2.6.1</jackson.version>
89+
<jackson.version>2.6.3</jackson.version>
9090
<janino.version>2.7.8</janino.version>
9191
<javassist.version>3.18.1-GA</javassist.version> <!-- Same as Hibernate -->
9292
<javax-cache.version>1.0.0</javax-cache.version>

0 commit comments

Comments
 (0)