[
https://issues.apache.org/jira/browse/AVRO-1365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17563660#comment-17563660
]
Christophe Le Saec commented on AVRO-1365:
------------------------------------------
Here, o1 & o2 can't be null if of type "ENUM", and nor NULL, nor Union(ENUM,
NULL)
So, NPE means that at least one object doesn't respect the schema.
> NPE thrown when comparing objects using GenericData.compare
> -----------------------------------------------------------
>
> Key: AVRO-1365
> URL: https://issues.apache.org/jira/browse/AVRO-1365
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.5
> Reporter: Douglas Kaminsky
> Priority: Minor
> Labels: beginner
>
> When comparing two objects using GenericData.compare (directly or
> indirectly), null values in fields of record type objects are not
> sufficiently protected against, resulting in NPE
> e.g.
> {code}
> case ENUM:
> return s.getEnumOrdinal(o1.toString()) - s.getEnumOrdinal(o2.toString());
> {code}
> This is prevalent throughout the {{compare}} method. This impacts
> {{compareTo}}, and {{equals}} implementations as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)