-
Notifications
You must be signed in to change notification settings - Fork 117
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
Cannot deserialize OffsetDateTime.MIN
or OffsetDateTime.MAX
with ADJUST_DATES_TO_CONTEXT_TIME_ZONE
enabled
#166
Comments
Ok, thanks, this does seem to be an error. |
I wonder if code has assumption that values, but in UTC, would be limits? And thereby actual min/max would be considered to be outside, since normalized date (once value normalized to UTC) would then fall outside numeric values, in both cases. |
I digged a little bit deeper into the issue and the problem seems to be the When enabled the deserializer will try to convert the Deserializing Any ideas on how to fix this @cowtowncoder @kupci ? As this is more or less a conceptual problem with the |
Nice find! A workaround is always good to have. I agree, first thing is to update the documentation. As for a solution, I've been wondering how to solve this and one thought is that, with the |
Your approach seems reasonable to me! I think the required check would need to be a little more complicated though, since we need to look for The current behaviour is that the code catches the |
Good point, that would be a cleaner solution. Though instead of the catch block, I would put this as part of the If you have tests & implementation, I can review a PR, or vice versa, and then see what @cowtowncoder thinks.. |
What @kupci just said. :) |
I can work on a PR! I can think of two ways of implementing the "is normalizable" check:
Which one would you go for? |
Possible fix for FasterXML#166. This commit adds a check before the OffsetDateTime adjustment of ADJUST_DATES_TO_CONTEXT_TIME_ZONE that ensures that the OffsetDateTime is normalizeable given a specific time zone offset. When it is not, normalization is skipped and the un-adjusted OffsetDateTime is returned.
I think either would work as these values seem unlikely to serve anything more than as markers. |
Fix for FasterXML#166. This commit introduces static constants for the minimum and the maximum OffsetDateTimes that are adjustable to all possible time zones in InstantDeserializer and adds a check that an OffsetDateTime lies in these boundaries before it is adjusted.
Fix available via PR, only waiting for CLA. |
OffsetDateTime.MIN
or OffsetDateTime.MAX
with ADJUST_DATES_TO_CONTEXT_TIME_ZONE
enabled
This probably relates to #124.
I cannot deserialize
OffsetDateTime.MIN
andOffsetDateTime.MAX
.With
jackson-databind
andjackson-datatype-jsr310
(both 2.10.3) on my class path the following works:The following does not work:
Removing the offset or shifting the time by the respective amount of hours seems to work again:
The text was updated successfully, but these errors were encountered: