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

Union of enum and null can result in NPE on validate if null is not first

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.6
    • 1.8.0, 1.9.0
    • java
    • None

    Description

      The ENUM case in validate is missing a null check for datum:

          case ENUM:
            return schema.getEnumSymbols().contains(datum.toString());
      

      This leads to a surprising error where a NPE is thrown for a union of enum and null when the enum is first in the union. If null is first it works. The fix is a simple. I'm creating a patch that adds the fix and a unit test for this case.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mhayes Matthew Hayes Assign to me
            mhayes Matthew Hayes
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment