You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2008/12/07 21:39:44 UTC

[jira] Commented: (THRIFT-228) Ruby version of binaryprotocol.rb has an outdated version of read_message_begin

    [ https://issues.apache.org/jira/browse/THRIFT-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654241#action_12654241 ] 

Bryan Duxbury commented on THRIFT-228:
--------------------------------------

Can you post this change as a patch file? When you attach a file, you're given the opportunity to grant license to the ASF.

> 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.