Repository: thrift
Updated Branches:
  refs/heads/master bd05f9e06 -> ad67aa0ac


THRIFT-2581 C++ TFDTransport destructor should not throw


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/ad67aa0a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/ad67aa0a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/ad67aa0a

Branch: refs/heads/master
Commit: ad67aa0acf0bb75ceb650e61626e9f51cb28549f
Parents: bd05f9e
Author: henrique <[email protected]>
Authored: Tue Jun 24 15:45:41 2014 +0200
Committer: henrique <[email protected]>
Committed: Tue Jun 24 15:45:41 2014 +0200

----------------------------------------------------------------------
 lib/cpp/src/thrift/transport/TFDTransport.h | 7 ++++++-
 lib/cpp/test/TFDTransportTest.cpp           | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/ad67aa0a/lib/cpp/src/thrift/transport/TFDTransport.h
----------------------------------------------------------------------
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 @@ 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());
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/ad67aa0a/lib/cpp/test/TFDTransportTest.cpp
----------------------------------------------------------------------
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 @@ 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&) {
   }
 

Reply via email to