Jeff Reinecke created THRIFT-2004:
-------------------------------------

             Summary: Thrift::Union violates :== method contract and crashes
                 Key: THRIFT-2004
                 URL: https://issues.apache.org/jira/browse/THRIFT-2004
             Project: Thrift
          Issue Type: Bug
          Components: Ruby - Library
    Affects Versions: 0.9
         Environment: MacOS X, ruby 1.9 and 2.0
            Reporter: Jeff Reinecke


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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to