Skip to content

Commit 4610a84

Browse files
committed
Merge branch '2.19'
2 parents 1afac89 + 9ad4309 commit 4610a84

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

datetime/src/test/java/tools/jackson/datatype/jsr310/deser/LocalDateTimeDeserTest.java

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

678+
// [datatype-jsr310#124] Issue serializing and deserializing LocalDateTime.MAX and LocalDateTime.MIN
679+
@Test
680+
public void testDeserializationOfLocalDateTimeMax() throws Exception
681+
{
682+
ObjectMapper enabledMapper = mapperBuilder()
683+
.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).build();
684+
_testLocalDateTimeRoundTrip(enabledMapper, LocalDateTime.MAX);
685+
_testLocalDateTimeRoundTrip(enabledMapper, LocalDateTime.MIN);
686+
687+
ObjectMapper disabledMapper = mapperBuilder()
688+
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).build();
689+
_testLocalDateTimeRoundTrip(disabledMapper, LocalDateTime.MAX);
690+
_testLocalDateTimeRoundTrip(disabledMapper, LocalDateTime.MIN);
691+
}
692+
693+
private void _testLocalDateTimeRoundTrip(ObjectMapper mapper, LocalDateTime localDateTime)
694+
throws Exception
695+
{
696+
String ser = mapper.writeValueAsString(localDateTime);
697+
LocalDateTime result = mapper.readValue(ser, LocalDateTime.class);
698+
assertEquals(localDateTime, result);
699+
}
700+
678701
private void expectSuccess(ObjectReader reader, Object exp, String json) throws IOException {
679702
final LocalDateTime value = reader.readValue(a2q(json));
680703
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)