This commit fixes a bug for record default values that do not specify default values for each field. If a field is optional and is missing a default value in the record default value, fieldValue in translateField() will be null instead of Data.NULL.
Without this fix, Avro schema translation will fail with a NullPointerException.
java.lang.NullPointerException
at com.linkedin.data.avro.AbstractDefaultDataTranslator.translate(AbstractDefaultDataTranslator.java:136)
at com.linkedin.data.avro.DefaultAvroToDataConvertCallback.translateField(DefaultAvroToDataConvertCallback.java:88)
at com.linkedin.data.avro.AbstractDefaultDataTranslator.translate(AbstractDefaultDataTranslator.java:138)
at com.linkedin.data.avro.DefaultAvroToDataConvertCallback.translateField(DefaultAvroToDataConvertCallback.java:88)
at com.linkedin.data.avro.DefaultAvroToDataConvertCallback.callback(DefaultAvroToDataConvertCallback.java:38)
at com.linkedin.data.schema.DataSchemaTraverse.traverseRecurse(DataSchemaTraverse.java:92)
at com.linkedin.data.schema.DataSchemaTraverse.traverse(DataSchemaTraverse.java:75)
at com.linkedin.data.schema.DataSchemaTraverse.traverse(DataSchemaTraverse.java:64)
at com.linkedin.data.avro.SchemaTranslator.avroToDataSchema(SchemaTranslator.java:184)
at com.linkedin.data.avro.SchemaTranslator.avroToDataSchema(SchemaTranslator.java:238)
This commit fixes a bug for record default values that do not specify default values for each field. If a field is optional and is missing a default value in the record default value,
fieldValue
intranslateField()
will benull
instead ofData.NULL
.Without this fix, Avro schema translation will fail with a
NullPointerException
.