Skip to content

Commit

Permalink
Fix #319: add test to show databind 2.18.1 fixes issue (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder authored Sep 29, 2024
1 parent 869023f commit 310734f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.fasterxml.jackson.datatype.jsr310.misc;

import java.time.DateTimeException;

import org.junit.Test;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase;

import static org.junit.Assert.assertEquals;

public class DateTimeExceptionTest extends ModuleTestBase
{
private final ObjectMapper MAPPER = newMapper();

// [modules-java#319]: should not fail to ser/deser DateTimeException
@Test
public void testDateTimeExceptionRoundtrip() throws Exception
{
String json = MAPPER.writeValueAsString(new DateTimeException("Test!"));
DateTimeException result = MAPPER.readValue(json, DateTimeException.class);
assertEquals("Test!", result.getMessage());
}
}
4 changes: 4 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,7 @@ Emanuel Trandafir (@etrandafir93)
* Contribtued fix for #274: Deserializing `java.time.Month` from an int causes an off-by-one
error (`0`->`Jan`,`11`->`Dec`), because it's an enum
(2.17.0)

Ólafur Bragason (@olibraga)
* Reported #319: `java.time.DateTimeException` serialization fails
(2.18.1)
5 changes: 5 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Modules:
=== Releases ===
------------------------------------------------------------------------

2.18.1 (not yet released)

#319: `java.time.DateTimeException` serialization fails
(repored by Ólafur B)

2.18.0 (26-Sep-2024)

No changes since 2.17
Expand Down

0 comments on commit 310734f

Please sign in to comment.