avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Busbey (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first
Date Mon, 14 Jul 2014 15:12:05 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14060737#comment-14060737
] 

Sean Busbey commented on AVRO-1544:
-----------------------------------

+1 LGTM. Ran through without fix and test failed, after fix test passed.

> Union of enum and null can result in NPE on validate if null is not first
> -------------------------------------------------------------------------
>
>                 Key: AVRO-1544
>                 URL: https://issues.apache.org/jira/browse/AVRO-1544
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.6
>            Reporter: Matthew Hayes
>         Attachments: AVRO-1544-v2.patch, AVRO-1544.patch
>
>
> The ENUM case in validate is missing a null check for datum:
> {code}
>     case ENUM:
>       return schema.getEnumSymbols().contains(datum.toString());
> {code}
> This leads to a surprising error where a NPE is thrown for a union of enum and null when
the enum is first in the union.  If null is first it works.  The fix is a simple.  I'm creating
a patch that adds the fix and a unit test for this case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message