Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in JSON Mapping for ZonedDateTime #116

Closed
hohwille opened this issue Jul 5, 2019 · 4 comments
Closed

Bug in JSON Mapping for ZonedDateTime #116

hohwille opened this issue Jul 5, 2019 · 4 comments
Labels
bug Something isn't working JSON all around JSON mapping like jackson, JSON-P, and JSON-B

Comments

@hohwille
Copy link
Member

hohwille commented Jul 5, 2019

It seems as if with #112 I found a bug in jacksons JavaTimeModule:
When a ZonedDateTime is deserialized, then Jackson uses InstantDeserializer when JavaTimeModule is in place. This is indeed producing a ZonedDateTime but the ZoneId is then added as offset and lost resulting in being "1999-12-31T23:59:59+02:00" deserialized as "1999-12-31T21:59:59Z[UTC]".
I traced it down to the root which is here:
https://github.com/FasterXML/jackson-modules-java8/blob/master/datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/deser/InstantDeserializer.java#L209

Actually one would need to use ZonedDateTime.parse(CharSequence) to properly deserialize ZonedDateTime.

@hohwille
Copy link
Member Author

hohwille commented Jul 5, 2019

This test is failing so @Ignore was added:

public void testJavaTimeZonedDateTime() throws Exception {

@hohwille
Copy link
Member Author

We need to configure DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE.

@hohwille hohwille added this to the release:3.3.0 milestone Dec 13, 2019
@hohwille hohwille added bug Something isn't working JSON all around JSON mapping like jackson, JSON-P, and JSON-B labels Dec 13, 2019
@hohwille
Copy link
Member Author

Fixed with PR #185 thanks to @vapadwal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working JSON all around JSON mapping like jackson, JSON-P, and JSON-B
Projects
None yet
Development

No branches or pull requests

1 participant