Skip to content

Commit

Permalink
Normalize ZoneId objects before serializing them
Browse files Browse the repository at this point in the history
Signed-off-by: Gyúróczki Gergő <gergonoorbi@gmail.com>
  • Loading branch information
Degubi committed Jun 15, 2020
1 parent b46af5e commit cbda513
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public ZoneIdTypeSerializer(Customization customization) {

@Override
protected void serialize(ZoneId obj, JsonGenerator generator, Marshaller marshaller) {
generator.write(obj.getId());
generator.write(obj.normalized().getId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ public void testZonedDateTime() {
@Test
public void testMarshalZoneId() {
assertEquals("{\"value\":\"Europe/Prague\"}", bindingJsonb.toJson(new ScalarValueWrapper<>(ZoneId.of("Europe/Prague"))));
assertEquals("\"Z\"", bindingJsonb.toJson(ZoneId.of("UTC"))); // Issue #387
}

@Test
Expand Down

0 comments on commit cbda513

Please sign in to comment.