Date: Monday, November 28, 2005 @ 16:17:58
  Author: marc
    Path: /cvsroot/carob/carob

Modified: include/CarobException.hpp (1.13 -> 1.14) src/CarobException.cpp
          (1.9 -> 1.10) test/CarobProtector.hpp (1.4 -> 1.5)

- (remote) StackTrace is now implemented using a vector of objects instead of 
vector of pointers
- using more initializers and less assignements in CarobException constructor


----------------------------+
 include/CarobException.hpp |    2 +-
 src/CarobException.cpp     |   21 +++++++--------------
 test/CarobProtector.hpp    |   10 +++++++++-
 3 files changed, 17 insertions(+), 16 deletions(-)


Index: carob/include/CarobException.hpp
diff -u carob/include/CarobException.hpp:1.13 
carob/include/CarobException.hpp:1.14
--- carob/include/CarobException.hpp:1.13       Mon Nov 28 14:52:00 2005
+++ carob/include/CarobException.hpp    Mon Nov 28 16:17:58 2005
@@ -45,7 +45,7 @@
 // TODO: replace this by a vector of actual objects, so we can
 // delete our custom copiers and destructors. No need for
 // performance here, cause exceptions are not on the critical path.
-typedef vector<StackTraceElement*> StackTrace;
+typedef vector<StackTraceElement> StackTrace;
 
 /**
  * Mother class of all exceptions send by the driver defining common exception 
Index: carob/src/CarobException.cpp
diff -u carob/src/CarobException.cpp:1.9 carob/src/CarobException.cpp:1.10
--- carob/src/CarobException.cpp:1.9    Mon Nov 28 14:52:00 2005
+++ carob/src/CarobException.cpp        Mon Nov 28 16:17:58 2005
@@ -47,20 +47,15 @@
     delete causePtr;
     causePtr = NULL;
   }
-  for (size_t i=0; i<stackTrace.size(); i++)
-  {
-    delete stackTrace[i];
-    stackTrace[i] = NULL;
-  }
 }
 
-CarobException::CarobException(const CarobException& ce) : 
backTrace(ce.backTrace)
+CarobException::CarobException(const CarobException& ce) :
+  message(ce.message),
+  stackTrace(ce.stackTrace),
+  SQLState(ce.SQLState),
+  errorCode(ce.errorCode),
+  backTrace(ce.backTrace)
 {
-  message = ce.message;
-  for (size_t i=0; i<ce.stackTrace.size(); i++)
-  {
-    stackTrace.push_back(new StackTraceElement(*(ce.stackTrace[i])));
-  }
   if (ce.causePtr != NULL)
   {
     causePtr = new CarobException(*(ce.causePtr));
@@ -69,8 +64,6 @@
   {
     causePtr = NULL;
   }
-  SQLState = ce.SQLState;
-  errorCode = ce.errorCode;
 }
 
 CarobException::CarobException(const DriverSocket& sock) : 
backTrace(currentBackTrace())
@@ -89,7 +82,7 @@
   sock>>stLength;
   for (int32_t i = 0; i < stLength; i++)
   {
-    stackTrace.push_back(new StackTraceElement(sock));
+    stackTrace.push_back(StackTraceElement(sock));
   }
   sock>>SQLState;
   sock>>errorCode;
Index: carob/test/CarobProtector.hpp
diff -u carob/test/CarobProtector.hpp:1.4 carob/test/CarobProtector.hpp:1.5
--- carob/test/CarobProtector.hpp:1.4   Mon Nov 28 11:10:23 2005
+++ carob/test/CarobProtector.hpp       Mon Nov 28 16:17:58 2005
@@ -36,7 +36,7 @@
   const StackTrace& st = cex.getStackTrace();
   for (StackTrace::const_iterator s = st.begin(); s != st.end(); s++)
     std::wcerr << prefix << "            : " // TODO: need a toString() method 
here
-               << (*s)->declaringClass << ":" << (*s)->methodName << "(...)" 
<< std::endl;;
+               << s->declaringClass << ":" << s->methodName << "(...)" << 
std::endl;;
 }
 
 
@@ -93,6 +93,14 @@
       cerrBackTrace(UEPREFIX, ue);
       reportError( context, CppUnit::Message("Unexp excp") );
     }
+    catch (const CarobException& ce)
+    {
+      logError(L"fctName", L"Catched carob exception");
+      // TODO
+      cerrBackTrace(CEPREFIX, ce);
+      reportError( context, CppUnit::Message("carob excp") );
+    }
+
     return false; // meaning: failed?
   }
 

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to