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

Fix MemoryBuffer.pm to raise a proper exception if no data is available

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.14.0
    • Component/s: Perl - Library
    • Labels:
      None

      Description

      MemoryBuffer.pm is implemented as follows, but it doesn't raise a TTransportException when no data is available.

      lib/perl/lib/Thrift/MemoryBuffer.pm
      113 sub readAll
      114 {
      115     my $self = shift;
      116     my $len  = shift;
      117
      118     my $avail = ($self->{wPos} - $self->{rPos});
      119     if ($avail < $len) {
      120         die TTransportException->new("Attempt to readAll($len) found only $avail available",
      121                                     Thrift::TTransportException::END_OF_FILE);
      122     }
      123
      

      Instead, it dies due to a wrong package name as follows. The right name is Thrift::TTransportException.

      $ perl -Ilib -de 1
      
      (snip)
      
        DB<1> use Thrift::BinaryProtocol
      
        DB<2> use Thrift::MemoryBuffer
      
        DB<3> $trans = Thrift::MemoryBuffer->new
      
        DB<4> $proto = Thrift::BinaryProtocol->new($trans)
      
        DB<5> $s
      
        DB<6> $proto->readString(\$s)
      Can't locate object method "new" via package "TTransportException" (perhaps you forgot to load "TTransportException"?) at lib/Thrift/MemoryBuffer.pm line 120.
      

        Attachments

          Activity

            People

            • Assignee:
              sekikn Kengo Seki
              Reporter:
              sekikn Kengo Seki

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                  Issue deployment