[
https://issues.apache.org/jira/browse/AVRO-844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057496#comment-13057496
]
Doug Cutting commented on AVRO-844:
-----------------------------------
For the first check I think it might be better to ensure that getFields can
never return null. Right now it can only return null if you create a schema
with Schema.createRecord(String,String,String,boolean) but never call
Schema.setFields() before calling getFields(). I think this is an error; one
should always call setFields() when creating a record schema this way. So we
might check for null and throw an exception in getFields(). That would fix
this NPE and potentially lots of others.
> Better null checking in GenericData
> -----------------------------------
>
> Key: AVRO-844
> URL: https://issues.apache.org/jira/browse/AVRO-844
> Project: Avro
> Issue Type: Improvement
> Affects Versions: 1.5.1
> Reporter: Bill Graham
> Attachments: AVRO_844-1.patch
>
>
> A few places where NPEs can be handled better:
> * When adding an invalid field to a {{GenericData.Record}} object, an NPE
> gets throw.
> * When creating a {{GenericData.Record}} object with an invalid Schema an NPE
> is throw.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira