From: henrique Date: Tue, 24 Jun 2014 13:45:41 +0000 (+0200) Subject: THRIFT-2581 C++ TFDTransport destructor should not throw X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=ad67aa0acf0bb75ceb650e61626e9f51cb28549f;p=common%2Fthrift.git THRIFT-2581 C++ TFDTransport destructor should not throw --- 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&) { }