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 cc4f9c1..a337d8d 100644
--- a/lib/cpp/src/thrift/transport/TFDTransport.h
+++ b/lib/cpp/src/thrift/transport/TFDTransport.h
@@ -48,7 +48,12 @@
~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 7ffca71..e30d9c0 100644
--- a/lib/cpp/test/TFDTransportTest.cpp
+++ b/lib/cpp/test/TFDTransportTest.cpp
@@ -35,6 +35,7 @@
try {
{
TFDTransport t(256, TFDTransport::CLOSE_ON_DESTROY);
+ t.close();
}
std::abort();
} catch (TTransportException) {
@@ -47,7 +48,7 @@
}
std::abort();
} catch (TTransportException&) {
- abort();
+ std::abort();
} catch (DummyException&) {
}