You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Matthew Hayes (JIRA)" <ji...@apache.org> on 2014/07/12 17:49:04 UTC

[jira] [Created] (AVRO-1544) Union of enum and null can result in NPE on validate if null is not first

Matthew Hayes created AVRO-1544:
-----------------------------------

             Summary: 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


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)