Ruby version of binaryprotocol.rb has an outdated version of read_message_begin
-------------------------------------------------------------------------------
Key: THRIFT-228
URL: https://issues.apache.org/jira/browse/THRIFT-228
Project: Thrift
Issue Type: Bug
Components: Library (Ruby)
Affects Versions: 0.1
Environment: Ubuntu 8.04 on i386 arctitecture. Ruby 1.8.6.
Reporter: Chandranshu
Priority: Critical
Following exception is raised by the read_message_begin method"
/usr/local/lib/site_ruby/1.8/thrift/protocol/binaryprotocol.rb:82:in
'read_message_begin': Missing version identifier (Thrift::ProtocolException)
from /usr/local/lib/site_ruby/1.8/thrift/client.rb:26:in `receive_message'
Comparing the implementation of the method in the Ruby class
Thrift::BinaryProtocol to its python counterpart TBinaryProtocol shows that the
Ruby method is quite outdated. I have changed the method to be:
def read_message_begin
version = read_i32
if(version <0)
if (version & VERSION_MASK != VERSION_1)
raise ProtocolException.new(ProtocolException::BAD_VERSION, 'Missing
version identifier')
end
type = version & 0×000000ff
name = read_string
seqid = read_i32
else
name = trans.readAll(version)
type = read_byte
seqid = read_i32
end
[name, type, seqid]
end
This does not raise an exception on the strict read condition in the else
clause as is raised by the Python version but can be easily added to.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.