Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3993

Writing an AVRO enum field with an invalid value generates unhelpful NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • java

    Description

      When an enum field is written with a symbol that is not one of the valid enum symbols configured in the schema, the code generates a NPE which turns into a null value message which is not extremely helpful. It would be useful if the message mentioned the invalid symbol and the available symbols from the schema.

      Here's a sample of the generated stack trace.  More in the attachment:

      java.lang.NullPointerException: null value for (non-nullable) enum1 at record1.field1
           ...
      Caused by: java.lang.NullPointerException
           at org.apache.avro.Schema$EnumSchema.getEnumOrdinal(Schema.java:1118)
      ...

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dig090 Gray
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m