From ad67aa0acf0bb75ceb650e61626e9f51cb28549f Mon Sep 17 00:00:00 2001 From: henrique Date: Tue, 24 Jun 2014 15:45:41 +0200 Subject: [PATCH] THRIFT-2581 C++ TFDTransport destructor should not throw --- lib/cpp/src/thrift/transport/TFDTransport.h | 7 ++++++- lib/cpp/test/TFDTransportTest.cpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/cpp/src/thrift/transport/TFDTransport.h b/lib/cpp/src/thrift/transport/TFDTransport.h index cc4f9c11..a337d8da 100644 --- a/lib/cpp/src/thrift/transport/TFDTransport.h +++ b/lib/cpp/src/thrift/transport/TFDTransport.h @@ -48,7 +48,12 @@ class TFDTransport : public TVirtualTransport { ~TFDTransport() { if (close_policy_ == CLOSE_ON_DESTROY) { - close(); + try { + close(); + } catch(TTransportException& ex) { + GlobalOutput.printf("~TFDTransport TTransportException: '%s'", + ex.what()); + } } } diff --git a/lib/cpp/test/TFDTransportTest.cpp b/lib/cpp/test/TFDTransportTest.cpp index 7ffca714..e30d9c0b 100644 --- a/lib/cpp/test/TFDTransportTest.cpp +++ b/lib/cpp/test/TFDTransportTest.cpp @@ -35,6 +35,7 @@ int main() { try { { TFDTransport t(256, TFDTransport::CLOSE_ON_DESTROY); + t.close(); } std::abort(); } catch (TTransportException) { @@ -47,7 +48,7 @@ int main() { } std::abort(); } catch (TTransportException&) { - abort(); + std::abort(); } catch (DummyException&) { } -- 2.17.1