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

GenericDatumWriter.write must require encoder to be not null

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9.0
    • Component/s: java
    • Labels:
      None

      Description

      I was recently doing some debugging and writing tests for Avro and I received the following stack trace:

      java.lang.NullPointerException: null of E in field f of R
      	at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:147)
      	at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:141)
      	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:77)
      	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:64)
      

      That took me quite awhile to decipher. How about me Avro a library for laypeople. I propose:

      java.lang.NullPointerException: Encoder cannot be null
      	at java.util.Objects.requireNonNull(Objects.java:228)
      	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:63)
      	at org.apache.avro.test.basic.ExtendedEnumPerf.encode(ExtendedEnumPerf.java:26)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                belugabehr David Mollitor
                Reporter:
                belugabehr David Mollitor
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: