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

GenericDatumWriter#writeWithoutConversion throws NullPointerException

    XMLWordPrintableJSON

Details

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

    Description

      Currently, GenericDatumWriter#writeWithoutConversion throws an NPE if some field is not defined as it should according to the schema.

      I guess this is a matter of test, but as API client I'd like to rather get back an Avro-specific (runtime) exception (e.g., AvroWriteException), even if it wraps around an NPE. This makes it much more natural for writing libraries around.

      With the code as it stands, my only choice to handle this would be to try/catch(npe), which doesn't feel great.

      Debugging experience would also be improved if additional checks were implemented directly in writeWithoutConversion instead of letting the encoder implementations fail miserably because of null values

      Attachments

        Activity

          People

            Unassigned Unassigned
            dsebastien Sebastien Dubois
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: