Date: Monday, December 18, 2006 @ 17:55:31
  Author: gilles
    Path: /cvsroot/carob/carob/src

Modified: DriverSocket.cpp (1.22 -> 1.23)

Fixed CAROB-101: now catch codec exception in <<wstring operator
Just prints a big error message with full exception stack trace


------------------+
 DriverSocket.cpp |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)


Index: carob/src/DriverSocket.cpp
diff -u carob/src/DriverSocket.cpp:1.22 carob/src/DriverSocket.cpp:1.23
--- carob/src/DriverSocket.cpp:1.22     Fri Dec  8 18:02:08 2006
+++ carob/src/DriverSocket.cpp  Mon Dec 18 17:55:31 2006
@@ -23,6 +23,8 @@
 
 #include "CarobException.hpp"
 
+#include <sstream>
+
 using std::wstring;
 
 using namespace CarobNS;
@@ -35,10 +37,20 @@
   *this<<true;
   size_t strLen = s.size();
   *this<<static_cast<int32_t>(strLen);
-  // FIXME: catch CodecException here. See CAROB-101
-  for (size_t idx=0; idx < strLen; idx+=STRING_CHUNK_SIZE)
-    writeJavaUTF(s.substr(idx, STRING_CHUNK_SIZE));
-
+  try
+  {
+    for (size_t idx=0; idx < strLen; idx+=STRING_CHUNK_SIZE)
+      writeJavaUTF(s.substr(idx, STRING_CHUNK_SIZE));
+  }
+  catch (CodecException ce)
+  {
+    std::wostringstream buffer;
+    buffer<<L"Invalid input string '"<<s<<L"' to send. Exception was:"<<ce;
+    if (isErrorEnabled())
+    {
+      logError(L"DriverSocket::operator<<(wstring)", buffer.str());
+    }
+  }
   return *this;
 }
 

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

Reply via email to