Skip to content

Commit 310734f

Browse files
authored
Fix #319: add test to show databind 2.18.1 fixes issue (#321)
1 parent 869023f commit 310734f

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fasterxml.jackson.datatype.jsr310.misc;
2+
3+
import java.time.DateTimeException;
4+
5+
import org.junit.Test;
6+
7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase;
9+
10+
import static org.junit.Assert.assertEquals;
11+
12+
public class DateTimeExceptionTest extends ModuleTestBase
13+
{
14+
private final ObjectMapper MAPPER = newMapper();
15+
16+
// [modules-java#319]: should not fail to ser/deser DateTimeException
17+
@Test
18+
public void testDateTimeExceptionRoundtrip() throws Exception
19+
{
20+
String json = MAPPER.writeValueAsString(new DateTimeException("Test!"));
21+
DateTimeException result = MAPPER.readValue(json, DateTimeException.class);
22+
assertEquals("Test!", result.getMessage());
23+
}
24+
}

release-notes/CREDITS-2.x

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,7 @@ Emanuel Trandafir (@etrandafir93)
199199
* Contribtued fix for #274: Deserializing `java.time.Month` from an int causes an off-by-one
200200
error (`0`->`Jan`,`11`->`Dec`), because it's an enum
201201
(2.17.0)
202+
203+
Ólafur Bragason (@olibraga)
204+
* Reported #319: `java.time.DateTimeException` serialization fails
205+
(2.18.1)

release-notes/VERSION-2.x

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Modules:
88
=== Releases ===
99
------------------------------------------------------------------------
1010

11+
2.18.1 (not yet released)
12+
13+
#319: `java.time.DateTimeException` serialization fails
14+
(repored by Ólafur B)
15+
1116
2.18.0 (26-Sep-2024)
1217

1318
No changes since 2.17

0 commit comments

Comments
 (0)