Thrift
  1. Thrift
  2. THRIFT-624

compareTo is broken for Unions with binary fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.2
    • Component/s: Java - Compiler
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      When comparing binary fields, it attempts to do the comparison by casting the objects to "Comparable" resulting in a class cast exception.

      1. thrift-624-v2.patch
        4 kB
        Bryan Duxbury
      2. thrift-624.patch
        1 kB
        Bryan Duxbury

        Activity

        Hide
        Bryan Duxbury added a comment -

        This patch makes a special case branch for byte[]s.

        Show
        Bryan Duxbury added a comment - This patch makes a special case branch for byte[]s.
        Hide
        Nathan Marz added a comment -

        In java "instanceof" is all lowercase. This seems like a good thing to add a test case for as well.

        Show
        Nathan Marz added a comment - In java "instanceof" is all lowercase. This seems like a good thing to add a test case for as well.
        Hide
        David Reiss added a comment -

        Is this related to THRIFT-226 ?

        Show
        David Reiss added a comment - Is this related to THRIFT-226 ?
        Hide
        Bryan Duxbury added a comment -

        @Nathan: I see now that I do not have a comparable Union type defined in the test thrift files. I'll fix that.

        @David: Yes. If we switched to ByteBuffers, then this wouldn't be an issue.

        Show
        Bryan Duxbury added a comment - @Nathan: I see now that I do not have a comparable Union type defined in the test thrift files. I'll fix that. @David: Yes. If we switched to ByteBuffers, then this wouldn't be an issue.
        Hide
        Bryan Duxbury added a comment -

        Hm, looks like there was actually a bug in TBaseHelper for comparing byte[]s. Test coverage for the win.

        This patch adds a test for comparing unions with binaries in them and corrects noted bugs in previous patch.

        Show
        Bryan Duxbury added a comment - Hm, looks like there was actually a bug in TBaseHelper for comparing byte[]s. Test coverage for the win. This patch adds a test for comparing unions with binaries in them and corrects noted bugs in previous patch.
        Hide
        Nathan Marz added a comment -

        Looks good.

        Show
        Nathan Marz added a comment - Looks good.
        Hide
        Bryan Duxbury added a comment -

        I just committed this.

        Show
        Bryan Duxbury added a comment - I just committed this.

          People

          • Assignee:
            Bryan Duxbury
            Reporter:
            Nathan Marz
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development