Avro
  1. Avro
  2. AVRO-796

Problems using Schema.equals() method

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Not a Problem
    • Affects Version/s: 1.5.0
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None

      Description

      Schema.equals() does not properly handle null argument - the usual expected behavior is that it should return false.

      1. AVRO-796.patch
        0.6 kB
        Doug Cutting

        Activity

        Hide
        Douglas Kaminsky added a comment -

        Ditto for various typed schema subclasses

        Show
        Douglas Kaminsky added a comment - Ditto for various typed schema subclasses
        Hide
        Doug Cutting added a comment -

        I believe the null case is handled by instanceof in the equals implementation for each Schema subclass.

        http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.20.2

        I've attached an explicit test for this in a method that's called for each type of schema, and this passes for me.

        Show
        Doug Cutting added a comment - I believe the null case is handled by instanceof in the equals implementation for each Schema subclass. http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.20.2 I've attached an explicit test for this in a method that's called for each type of schema, and this passes for me.
        Hide
        Douglas Kaminsky added a comment -

        So it is - seems to be okay - sorry, I originally had another issue and thought this was the cause, but i was incorrect - the additional test is a great safeguard for future refactoring and I hope it will become part of the next release. Otherwise, I suppose this is not a bug.

        Show
        Douglas Kaminsky added a comment - So it is - seems to be okay - sorry, I originally had another issue and thought this was the cause, but i was incorrect - the additional test is a great safeguard for future refactoring and I hope it will become part of the next release. Otherwise, I suppose this is not a bug.
        Hide
        Douglas Kaminsky added a comment -

        Per comments, resolving as not a problem. Please correct status if you'd prefer a different one.

        Show
        Douglas Kaminsky added a comment - Per comments, resolving as not a problem. Please correct status if you'd prefer a different one.

          People

          • Assignee:
            Unassigned
            Reporter:
            Douglas Kaminsky
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development