-
Notifications
You must be signed in to change notification settings - Fork 118
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
YearKeyDeserializer
doesn't work with non-padded year values
#51
Milestone
Comments
Thank you for reporting this, sounds like a bug indeed. |
cowtowncoder
added
2.10
active
Issue being actively investigated and/or worked on
good first issue
Issue that seems easy to resolve and is likely a good candidate for contributors new to project
and removed
2.9
active
Issue being actively investigated and/or worked on
labels
Aug 13, 2019
Marking as One comment on solution: note that keys can only be Strings, whereas JSON values can be numbers, so handling is bit different by necessity. Still, solution as suggested above may be fine as long as it reports good parse exception for non-integer values. |
Merged
cowtowncoder
changed the title
YearKeyDeserializer doesn't work with non-padded year values
Sep 5, 2019
YearKeyDeserializer
doesn't work with non-padded year values
cowtowncoder
added a commit
that referenced
this issue
Sep 5, 2019
cowtowncoder
removed
the
good first issue
Issue that seems easy to resolve and is likely a good candidate for contributors new to project
label
Sep 5, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description & proposal
The
YearKeyDeserializer
is unable to deserialize keys that are not in the formatyyyy
(e.g. "1"). It expects the year to be padded with zeros ("0001").In contrast, the YearDeserializer is in fact working correctly and can handle non-padded values as well.
This could probably be fixed by changing the
YearKeyDeserializer#deserialize:30
to something like this (we've currently registered a custom deserializer that does this):Steps to reproduce
Here's a simple test to demonstrate the behavior:
The above will throw
java.time.format.DateTimeParseException: Text '1' could not be parsed at index 0
The text was updated successfully, but these errors were encountered: