Avro
  1. Avro
  2. AVRO-1007

Insufficient validation in generated specific record builder implementations

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.2
    • Component/s: None
    • Labels:

      Description

      The are two main problems with the generated build() method in specific record builders:

      • For non-primitive types, if there is no default value and the user does not set the value, build() will execute successfully without throwing an exception
        • Instead, an AvroRuntimeException should be thrown with an exception message indicating the name of the required field that was not set
      • For primitive types, if there is no default value and the user does not set the value, an AvroRuntimeException is thrown with the 'cause' set to a NullPointerException, which is not very helpful
        • The NPE comes from attempting to set the primitive field to the result of defaultValue(), which is null
      1. AVRO-1007.patch
        7 kB
        Doug Cutting
      2. AVRO-1007.patch
        6 kB
        Doug Cutting
      3. AVRO-1007.patch
        5 kB
        Doug Cutting
      4. AVRO-1007.patch
        3 kB
        James Baldassari
      5. AVRO-1007-v2.patch
        8 kB
        James Baldassari
      6. AVRO-1007-v3.patch
        11 kB
        James Baldassari
      7. AVRO-1007-v4.patch
        11 kB
        Scott Carey

        Activity

        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Doug Cutting made changes -
        Attachment AVRO-1007.patch [ 12513868 ]
        Doug Cutting made changes -
        Attachment AVRO-1007.patch [ 12513846 ]
        Doug Cutting made changes -
        Attachment AVRO-1007.patch [ 12513844 ]
        Scott Carey made changes -
        Attachment AVRO-1007-v4.patch [ 12513840 ]
        James Baldassari made changes -
        Attachment AVRO-1007-v3.patch [ 12513572 ]
        Scott Carey made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Fix Version/s 1.6.2 [ 12319074 ]
        James Baldassari made changes -
        Attachment AVRO-1007-v2.patch [ 12511823 ]
        James Baldassari made changes -
        Field Original Value New Value
        Attachment AVRO-1007.patch [ 12511818 ]
        James Baldassari created issue -

          People

          • Assignee:
            James Baldassari
            Reporter:
            James Baldassari
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development