-
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
NPE when serializing a LocalDate
or LocalDateTime
using AsDeductionTypeSerializer
#296
Comments
Is this the serializer and have you registered the related module ? |
Yep, that's the one. Note that this issue also effects |
@mike-reynolds-savient you repeated back the name of the class that I sent - did you mean to name a different class? |
Apologies - LocalDateTimeSerializer |
Version 2.14.2 is not the latest so would be good repro with 2.16.0. But also if this requires use of Java 8 Date/Time types, need to move to different repo; |
Ok, so, couple of things now that I re-read this again. First: I can definitely avoid NPE for But second, I think that |
Was able to reproduce (must force serialization as String), partial fix via #298, will try to cover all types for which NPE would be produced. |
LocalDate
or LocalDateTime
using AsDeductionTypeSerializer
@mike-reynolds-savient I fixed the NPE part for 2.16(.2) -- although it will be a month or two until that release. If you can try 2.16.2-SNAPSHOT to see how things work that'd be good. I am not confident DEDUCTION will work in general, but at least it should not fail with NPE no matter what. |
Many thanks @cowtowncoder |
Search before asking
Describe the bug
In v2.14.2 AsDeductionTypeSerializer was introduced.
Prior to this we could define an immutable interface as follows:
and set a value of LocalDate, LocalDateTime, OffsetDateTime etc as the return of
getValue()
This would serialize correctly with
JsonMapper.builder().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
set.We now get a "Cannot read field 'valueShape'" exception because
AsDeductionTypeSerializer
returns null if theWritableTypeId.valueShape
is not a structure start token.This results in an NPE within the
LocalDateTimeSerializer
class on line 89;Version Information
2.14.2
Reproduction
Expected behavior
If deduction cannot find the class it should return default property behaviour.
Additional context
FasterXML/jackson-databind#3711 (comment)
The text was updated successfully, but these errors were encountered: