Skip to content

Commit ecf1592

Browse files
committed
Merge branch '2.17' into 2.18
2 parents c860a7f + 1dd9e69 commit ecf1592

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

+23
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

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ Modules:
2121
2222
2.18.0 (26-Sep-2024)
2323
24-
No changes since 2.17
24+
2.17.4 (not yet released)
25+
26+
#124 Issue serializing and deserializing `LocalDateTime.MAX` and `LocalDateTime.MIN`
27+
(reported by @bachilast)
28+
(fix verified by Joo-Hyuk K)
2529
2630
2.17.3 (01-Nov-2024)
2731
2.17.2 (05-Jul-2024)

0 commit comments

Comments
 (0)