[cpp-sp] branch master updated: Add additional exception handlers for Xerces classes.

Scott Cantor cantor.2 at osu.edu
Thu Mar 7 12:53:44 EST 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=1a576a85052480c687e5ce80098359ea9cab8396

The following commit(s) were added to refs/heads/master by this push:
       new  1a576a8   Add additional exception handlers for Xerces classes.
1a576a8 is described below

commit 1a576a85052480c687e5ce80098359ea9cab8396
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Mar 7 12:53:39 2019 -0500

    Add additional exception handlers for Xerces classes.
---
 shibsp/remoting/impl/SocketListener.cpp | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/shibsp/remoting/impl/SocketListener.cpp b/shibsp/remoting/impl/SocketListener.cpp
index c9cbc14..bc8bc56 100644
--- a/shibsp/remoting/impl/SocketListener.cpp
+++ b/shibsp/remoting/impl/SocketListener.cpp
@@ -34,7 +34,9 @@
 #include <stack>
 #include <sstream>
 #include <boost/lexical_cast.hpp>
+#include <xercesc/sax/SAXException.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
+#include <xercesc/util/OutOfMemoryException.hpp>
 
 #include <xmltooling/util/NDC.h>
 #include <xmltooling/util/XMLHelper.h>
@@ -560,6 +562,24 @@ int ServerThread::job()
         // Dispatch the message.
         m_listener->receive(in, sink);
     }
+    catch (const xercesc::DOMException& e) {
+        auto_ptr_char temp(e.getMessage());
+        if (incomingError)
+            log.error("error processing incoming message: %s", temp.get() ? temp.get() : "no message");
+        XMLParserException ex(string("DOM error: ") + (temp.get() ? temp.get() : "no message"));
+        DDF out=DDF("exception").string(ex.toString().c_str());
+        DDFJanitor jout(out);
+        sink << out;
+    }
+    catch (const xercesc::SAXException& e) {
+        auto_ptr_char temp(e.getMessage());
+        if (incomingError)
+            log.error("error processing incoming message: %s", temp.get() ? temp.get() : "no message");
+        XMLParserException ex(string("SAX error: ") + (temp.get() ? temp.get() : "no message"));
+        DDF out=DDF("exception").string(ex.toString().c_str());
+        DDFJanitor jout(out);
+        sink << out;
+    }
     catch (const xercesc::XMLException& e) {
         auto_ptr_char temp(e.getMessage());
         if (incomingError)
@@ -569,6 +589,15 @@ int ServerThread::job()
         DDFJanitor jout(out);
         sink << out;
     }
+    catch (const xercesc::OutOfMemoryException& e) {
+        auto_ptr_char temp(e.getMessage());
+        if (incomingError)
+            log.error("error processing incoming message: %s", temp.get() ? temp.get() : "no message");
+        XMLParserException ex(string("Out of memory error: ") + (temp.get() ? temp.get() : "no message"));
+        DDF out=DDF("exception").string(ex.toString().c_str());
+        DDFJanitor jout(out);
+        sink << out;
+    }
     catch (const XMLToolingException& e) {
         if (incomingError)
             log.error("error processing incoming message: %s", e.what());

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list