Avro
  1. Avro
  2. AVRO-1051

SpecificData returns incorrect Class type for UNION in schema

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.3
    • Fix Version/s: 1.7.0
    • Component/s: java
    • Labels:

      Description

      Java reflection fails to find the method invoked by the client due to incorrect parameter types.

      This issue arises when a message request field has a UNION type where one type is "null" and the other type is a primitive like "int". In this case, the class type returned by the getClass(Schema) method in SpecificData is int instead of java.lang.Integer which results in a NoSuchMethodException.

        Activity

        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Doug Cutting added a comment -

        I committed this. Thanks, Hamed!

        Show
        Doug Cutting added a comment - I committed this. Thanks, Hamed!
        Doug Cutting made changes -
        Assignee Hamed Asghari [ hasghari ]
        Fix Version/s 1.7.0 [ 12318848 ]
        Hide
        Doug Cutting added a comment -

        +1 The patch looks good for me, tests pass, etc.

        I'll commit this soon unless someone objects.

        Show
        Doug Cutting added a comment - +1 The patch looks good for me, tests pass, etc. I'll commit this soon unless someone objects.
        Hamed Asghari made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Labels patch
        Hamed Asghari made changes -
        Attachment SpecificDataWithUnitTests.patch [ 12520267 ]
        Hide
        Hamed Asghari added a comment -

        Updating previous patch to add unit tests

        Show
        Hamed Asghari added a comment - Updating previous patch to add unit tests
        Hamed Asghari made changes -
        Attachment SpecificData.java.patch [ 12520224 ]
        Hamed Asghari made changes -
        Attachment SpecificData.java.patch [ 12520224 ]
        Hamed Asghari made changes -
        Attachment SpecificData.java.patch [ 12520185 ]
        Hide
        Hamed Asghari added a comment -

        Attached patch to fix this issue.

        Show
        Hamed Asghari added a comment - Attached patch to fix this issue.
        Hamed Asghari made changes -
        Field Original Value New Value
        Attachment SpecificData.java.patch [ 12520185 ]
        Hamed Asghari created issue -

          People

          • Assignee:
            Hamed Asghari
            Reporter:
            Hamed Asghari
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development