[ 
https://issues.apache.org/jira/browse/THRIFT-5050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-5050.
--------------------------------
    Fix Version/s: 0.14.0
       Resolution: Fixed

> Fix MemoryBuffer.pm to raise a proper exception if no data is available
> -----------------------------------------------------------------------
>
>                 Key: THRIFT-5050
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5050
>             Project: Thrift
>          Issue Type: Bug
>          Components: Perl - Library
>            Reporter: Kengo Seki
>            Assignee: Kengo Seki
>            Priority: Major
>             Fix For: 0.14.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> MemoryBuffer.pm is implemented as follows, but it doesn't raise a 
> {{TTransportException}} when no data is available.
> {code:title=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
> {code}
> Instead, it dies due to a wrong package name as follows. The right name is 
> {{Thrift::TTransportException}}.
> {code}
> $ 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.
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to