-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Deserialize time-only XMLGregorianCalendar #1167
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
Deserialize time-only XMLGregorianCalendar #1167
Conversation
…ws InvalidFormatException when parsing XMLGregorianCalendar using Jackson date format, fallback to parsing using XML Schema date / datetime / time / etc. lexical representation. This adds support for time-only XMLGregorianCalendar.
Thank you for your help here. I am not quite sure what the nested handling here is meant to achieve. From comments it would seem like it would be to support "accept single value as array" feature; but this is not responsibility of value deserializers; it is something array/Collection deserializers take care of. So I think that does not belong here. Other than this code does a fallback, which probably makes sense. |
I would normally agree that "accept single value as array" shouldn't be implemented here. But, the existing
Therefore, I thought that I might need to handle this same situation in my new code. e.g., if When I catch the exception in my new So, I need to get the depth before I call I should only remove the iterative nested array handling if one of the following is correct:
Does what I'm saying make sense? |
Oh. Yes you are absolutely right -- I had forgotten that there is such handling sprinkled around in a few places. With that, it makes bit more sense. I'll try to go over code again tomorrow. |
I would imagine that the best way to universally handle nested single-element arrays would be to refactor the Jackson code to use my iterative nesting handling before Thanks for looking over this. |
@rgoldberg Yeah the whole nesting/unnesting is an unfortunate detour. |
Do I need to change anything? |
@rgoldberg no I think you are good. Next (and last I hope) question: have I asked for a CLA yet? It's found from https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf and typically you print, fill & sign, scan and email to |
Just emailed the signed CLA. |
Hmmh. I wish there was a unit test here... I will rewrite this patch slightly, but would prefer not breaking additional processing. I just realized that the base class already takes care of unwrapping, so there should not be need to handle it here. |
If
StdDeserializer#_parseDate(JsonParser DeserializationContext)
throwsInvalidFormatException
when parsing anXMLGregorianCalendar
using the Jackson date format, fallback to parsing using the XML Schema date / datetime / time / etc. lexical representation.This adds support for time-only
XMLGregorianCalendar
.This is an implementation for #1165.
Can this be backported to 2.7.4, and also included in 2.8.0?