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

Kevin Clark edited comment on THRIFT-547 at 7/29/09 10:52 PM:
--------------------------------------------------------------

There's a ruby-debug require in base_transport_spec that needs to be removed. 

Also, I think maybe we're raising too early. I think if you ask for more data 
than exists, the data that can be fetched should be returned, just like 
transports on the wire. Once we get to 0 bytes though, I agree, we should be 
raising. eg: 

assume transport has "foobar" in it 

@transport.read(10) # => "foobar" 
@transport.available == 0 # => true 
@transport.read(10) # raises 

That way if a user is just asking for the most data they'd like to store (just 
give me up to 1k, 4k, etc) things work as expected, but once the buffer is 
empty we get the exception that's expected. What do you think?


      was (Author: kclark):
    There's a ruby-debug require in base_transport_spec that needs to be 
removed. 

Also, I think maybe we're raising too early. I think if you ask for more data 
than exists, the data that can be fetched should be returned, just like 
transports on the wire. Once we get to 0 bytes though, I agree, we should be 
raising. eg: 

# assume transport has "foobar" in it 
@transport.read(10) # => "foobar" 
@transport.available == 0 # => true 
@transport.read(10) # raises 

That way if a user is just asking for the most data they'd like to store (just 
give me up to 1k, 4k, etc) things work as expected, but once the buffer is 
empty we get the exception that's expected. What do you think?

  
> Thrift deserializer hangs when deserializing empty string
> ---------------------------------------------------------
>
>                 Key: THRIFT-547
>                 URL: https://issues.apache.org/jira/browse/THRIFT-547
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1
>         Environment: ruby 1.8.6
>            Reporter: Dayo Esho
>            Assignee: Bryan Duxbury
>            Priority: Minor
>         Attachments: thrift-547.patch
>
>
> Expect this to throw an error on empty strings and any other strings that 
> cannot be deserialized. Here is some code to reproduce:
> require 'thrift'
> class MyClass
>   include ::Thrift::Struct
>   FIELDS = {}
>   def struct_fields; FIELDS; end
>   def validate; end
> end
> deserializer = Thrift::Deserializer.new(Thrift::CompactProtocolFactory.new)
> deserializer.deserialize(MyClass.new, '') ###### hangs 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to