THRIFT-2581 C++ TFDTransport destructor should not throw
authorhenrique <henrique@apache.org>
Tue, 24 Jun 2014 13:45:41 +0000 (15:45 +0200)
committerhenrique <henrique@apache.org>
Tue, 24 Jun 2014 13:45:41 +0000 (15:45 +0200)
lib/cpp/src/thrift/transport/TFDTransport.h
lib/cpp/test/TFDTransportTest.cpp

index cc4f9c1..a337d8d 100644 (file)
@@ -48,7 +48,12 @@ class TFDTransport : public TVirtualTransport<TFDTransport> {
 
   ~TFDTransport() {
     if (close_policy_ == CLOSE_ON_DESTROY) {
-      close();
+      try {
+        close();
+      } catch(TTransportException& ex) {
+        GlobalOutput.printf("~TFDTransport TTransportException: '%s'",
+                            ex.what());
+      }
     }
   }
 
index 7ffca71..e30d9c0 100644 (file)
@@ -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&) {
   }