This is an automated email from the ASF dual-hosted git repository.
jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new cb4c31a THRIFT-5050 Fix MemoryBuffer.pm to raise a proper exception
if no data is available Client: perl Patch: Kengo Seki
cb4c31a is described below
commit cb4c31a0720e5449ac562b65ac7916f583d0cb7f
Author: Kengo Seki <[email protected]>
AuthorDate: Thu Dec 26 14:34:57 2019 +0900
THRIFT-5050 Fix MemoryBuffer.pm to raise a proper exception if no data is
available
Client: perl
Patch: Kengo Seki
This closes #1967
---
build/docker/ubuntu-bionic/Dockerfile | 3 ++-
build/docker/ubuntu-disco/Dockerfile | 3 ++-
build/docker/ubuntu-xenial/Dockerfile | 3 ++-
lib/perl/Makefile.PL | 3 +++
lib/perl/README.md | 6 ++++++
lib/perl/lib/Thrift/MemoryBuffer.pm | 2 +-
lib/perl/t/memory_buffer.t | 5 ++++-
7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/build/docker/ubuntu-bionic/Dockerfile
b/build/docker/ubuntu-bionic/Dockerfile
index 79d698f..fa8a2da 100644
--- a/build/docker/ubuntu-bionic/Dockerfile
+++ b/build/docker/ubuntu-bionic/Dockerfile
@@ -203,7 +203,8 @@ RUN apt-get install -y --no-install-recommends \
libclass-accessor-class-perl \
libcrypt-ssleay-perl \
libio-socket-ssl-perl \
- libnet-ssleay-perl
+ libnet-ssleay-perl \
+ libtest-exception-perl
RUN apt-get install -y --no-install-recommends \
`# Php dependencies` \
diff --git a/build/docker/ubuntu-disco/Dockerfile
b/build/docker/ubuntu-disco/Dockerfile
index 95a2c78..fd9464b 100644
--- a/build/docker/ubuntu-disco/Dockerfile
+++ b/build/docker/ubuntu-disco/Dockerfile
@@ -204,7 +204,8 @@ RUN apt-get install -y --no-install-recommends \
libclass-accessor-class-perl \
libcrypt-ssleay-perl \
libio-socket-ssl-perl \
- libnet-ssleay-perl
+ libnet-ssleay-perl \
+ libtest-exception-perl
RUN apt-get install -y --no-install-recommends \
`# Php dependencies` \
diff --git a/build/docker/ubuntu-xenial/Dockerfile
b/build/docker/ubuntu-xenial/Dockerfile
index 8df0887..af91e1b 100644
--- a/build/docker/ubuntu-xenial/Dockerfile
+++ b/build/docker/ubuntu-xenial/Dockerfile
@@ -213,7 +213,8 @@ RUN apt-get install -y --no-install-recommends \
libclass-accessor-class-perl \
libcrypt-ssleay-perl \
libio-socket-ssl-perl \
- libnet-ssleay-perl
+ libnet-ssleay-perl \
+ libtest-exception-perl
RUN apt-get install -y --no-install-recommends \
`# Php dependencies` \
diff --git a/lib/perl/Makefile.PL b/lib/perl/Makefile.PL
index 5e60ab4..b72a23e 100644
--- a/lib/perl/Makefile.PL
+++ b/lib/perl/Makefile.PL
@@ -34,6 +34,9 @@ WriteMakefile( ABSTRACT => 'Apache Thrift is a software
framework for scalable c
'Class::Accessor' => 0
},
# SIGN => 1,
+ TEST_REQUIRES => {
+ 'Test::Exception' => 0,
+ },
VERSION_FROM => 'lib/Thrift.pm' );
# THRIFT-4691
diff --git a/lib/perl/README.md b/lib/perl/README.md
index bd1e5b2..6958510 100644
--- a/lib/perl/README.md
+++ b/lib/perl/README.md
@@ -61,6 +61,12 @@ to use Thrift.
* Bit::Vector
* Class::Accessor
+## Test
+
+This is only required when running tests:
+
+ * Test::Exception
+
### HttpClient Transport
These are only required if using Thrift::HttpClient:
diff --git a/lib/perl/lib/Thrift/MemoryBuffer.pm
b/lib/perl/lib/Thrift/MemoryBuffer.pm
index be97ce4..5192cfb 100644
--- a/lib/perl/lib/Thrift/MemoryBuffer.pm
+++ b/lib/perl/lib/Thrift/MemoryBuffer.pm
@@ -117,7 +117,7 @@ sub readAll
my $avail = ($self->{wPos} - $self->{rPos});
if ($avail < $len) {
- die TTransportException->new("Attempt to readAll($len) found only
$avail available",
+ die Thrift::TTransportException->new("Attempt to readAll($len) found
only $avail available",
Thrift::TTransportException::END_OF_FILE);
}
diff --git a/lib/perl/t/memory_buffer.t b/lib/perl/t/memory_buffer.t
index 8fa9fd7..4a4ba0f 100644
--- a/lib/perl/t/memory_buffer.t
+++ b/lib/perl/t/memory_buffer.t
@@ -17,7 +17,8 @@
# under the License.
#
-use Test::More tests => 6;
+use Test::More tests => 7;
+use Test::Exception;
use strict;
use warnings;
@@ -33,6 +34,8 @@ use ThriftTest::Types;
my $transport = Thrift::MemoryBuffer->new();
my $protocol = Thrift::BinaryProtocol->new($transport);
+throws_ok { $protocol->readByte } 'Thrift::TTransportException';
+
my $a = ThriftTest::Xtruct->new();
$a->i32_thing(10);
$a->i64_thing(30);