-
-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Description
Version 2.9.0 and 2.9.8
Test to reproduce 07da0ea
I have event in newer version of schema and I want to deserialize it with older version. Newer schema has additional field which might be null. During deserialization there is NullPointerException :
java.lang.NullPointerException
at com.fasterxml.jackson.dataformat.avro.deser.UnionReader._decodeIndex(UnionReader.java:63)
at com.fasterxml.jackson.dataformat.avro.deser.UnionReader.skipValue(UnionReader.java:45)
at com.fasterxml.jackson.dataformat.avro.deser.AvroFieldReader$Structured.skipValue(AvroFieldReader.java:61)
at com.fasterxml.jackson.dataformat.avro.deser.RecordReader$Resolving.nextFieldName(RecordReader.java:222)
at com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.nextFieldName(AvroParserImpl.java:110)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1608)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1185)
at com.fasterxml.jackson.dataformat.avro.schemaev.ErrorReproduceTest.testShouldDeserialize(ErrorReproduceTest.java:72)
NullPointer occures when new field has UnionType null and one of(Record, Map, Array).
Newer schema which has additional field:
{
"type": "record",
"name": "V1",
"namespace": "test",
"doc": "simple schema version 2 testing compatibility",
"fields": [
{
"name": "name",
"type": "string",
"doc": "object name"
},
{
"name": "label",
"type":
[
"null",
{
"type" : "array",
"items" : "string"
}
],
"doc": "object label"
}
]
}
Older Schema:
{
"type": "record",
"name": "V1",
"namespace": "test",
"doc": "simple schema testing compatibility",
"fields": [
{
"name": "name",
"type": "string",
"doc": "object name"
}
]
}
I serialize event with newer schema and later I want to deserialize with older schema
{
"name" : "test",
"label": null
}
Do you have any idea how can I configure mapper to avoid this problem or it has to be fixed?
chemicL