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

RecordSchema#fieldsToJson can throw NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.7
    • 1.8.0
    • None
    • None

    Description

      The code just does

            for (Field f : fields) {
      

      without ever checking if fields is set. There is a createRecord version that does not take fields so this can be empty. This is especially annoying within the Scala/Spark REPL as that immediately prints out the result of everything you type so it calls toString which then fails and that even leaves the object unset in the REPL.

      I'll attach a patch that checks whether fields is null.

      Attachments

        1. AVRO-1655.2.patch
          4 kB
          Lars Francke
        2. AVRO-1655.1.patch
          2 kB
          Lars Francke

        Activity

          People

            larsfrancke Lars Francke
            larsfrancke Lars Francke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: