Skip to content

Commit 9ad4309

Browse files
committed
Merge branch '2.18' into 2.19
2 parents bdac46a + ecf1592 commit 9ad4309

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/deser/LocalDateTimeDeserTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,29 @@ public void testStrictCustomFormatForValidDateAndTimeWithoutEra() throws Excepti
655655
assertEquals(w.value, LocalDateTime.of(2019, 11, 30, 20, 45));
656656
}
657657

658+
// [datatype-jsr310#124] Issue serializing and deserializing LocalDateTime.MAX and LocalDateTime.MIN
659+
@Test
660+
public void testDeserializationOfLocalDateTimeMax() throws Exception
661+
{
662+
ObjectMapper enabledMapper = mapperBuilder()
663+
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).build();
664+
_testLocalDateTimeRoundTrip(enabledMapper, LocalDateTime.MAX);
665+
_testLocalDateTimeRoundTrip(enabledMapper, LocalDateTime.MIN);
666+
667+
ObjectMapper disabledMapper = mapperBuilder()
668+
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).build();
669+
_testLocalDateTimeRoundTrip(disabledMapper, LocalDateTime.MAX);
670+
_testLocalDateTimeRoundTrip(disabledMapper, LocalDateTime.MIN);
671+
}
672+
673+
private void _testLocalDateTimeRoundTrip(ObjectMapper mapper, LocalDateTime localDateTime)
674+
throws Exception
675+
{
676+
String ser = mapper.writeValueAsString(localDateTime);
677+
LocalDateTime result = mapper.readValue(ser, LocalDateTime.class);
678+
assertEquals(localDateTime, result);
679+
}
680+
658681
private void expectSuccess(ObjectReader reader, Object exp, String json) throws IOException {
659682
final LocalDateTime value = reader.readValue(a2q(json));
660683
assertNotNull("The value should not be null.", value);

release-notes/VERSION-2.x

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ Modules:
2525
2626
2.18.0 (26-Sep-2024)
2727
28-
No changes since 2.17
28+
2.17.4 (not yet released)
29+
30+
#124 Issue serializing and deserializing `LocalDateTime.MAX` and `LocalDateTime.MIN`
31+
(reported by @bachilast)
32+
(fix verified by Joo-Hyuk K)
2933
3034
2.17.3 (01-Nov-2024)
3135
2.17.2 (05-Jul-2024)

0 commit comments

Comments
 (0)