Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2004

Thrift::Union violates :== method contract and crashes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.9
    • 0.9.3
    • Ruby - Library
    • None
    • MacOS X, ruby 1.9 and 2.0

    Description

      Thrift::Union violates the contract for the :== method, by assuming that the passed argument is either nil or a Thrift::Union (by calling methods that only exist on Thrift::Union). An extra clause should be put in to test if it is not a Union and fail.

      Idiomatically, this should be done via duck typing making the method be:
      def ==(other)
      nil && other.repond_to?(:get_set_field) && other.respond_to?(:get_value) && @setfield == other.get_set_field && @value == other.get_value
      end

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              paploo Jeff Reinecke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: