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

NPE on recursive datatype in JSON encoder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 1.7.7
    • None
    • java
    • None

    Description

      When trying to encode to JSON a record whose schema contains a recursive type embedded in another type (ie. an array), the "flatten" method in the Parser leaves a hole in the middle of the symbol stack which causes a NPE to occur. My best guess is that it's leaving space for the embedded recursion but never populating the symbol, but that code is a bit obtuse so I am having trouble getting to the root cause (otherwise I would have provided a patch to solve the problem as well).

      Attached is a class with a short main method that replicates the problem with anonymized versions of my datatypes/record and a screenshot of the symbol stack at runtime right before the error occurs.

      Not yet tested in 1.8.0 but should be easy to verify.

      Attachments

        1. RecursiveFlattenBugRegression.java
          5 kB
          Douglas Kaminsky
        2. symbolstack.png
          117 kB
          Douglas Kaminsky

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dkaminsky Douglas Kaminsky
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: