[cpp-sp COMMIT] in /branches/REL_2: odbc-store/odbc-store.cpp shibsp/impl/StorageServiceSessionCache.cpp

noreply at shibboleth.net noreply at shibboleth.net
Sun Jul 5 15:13:05 EDT 2015


Author: scantor
Date: Sun Jul  5 15:13:04 2015
New Revision: 3923

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3923&view=rev
Log:
CPPXT-104 - Add exception handling to integer conversions

Modified:
    branches/REL_2/odbc-store/odbc-store.cpp
    branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp

Modified: branches/REL_2/odbc-store/odbc-store.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/odbc-store/odbc-store.cpp?rev=3923&r1=3922&r2=3923&view=diff
==============================================================================
--- branches/REL_2/odbc-store/odbc-store.cpp	(original)
+++ branches/REL_2/odbc-store/odbc-store.cpp	Sun Jul  5 15:13:04 2015
@@ -332,8 +332,14 @@
     e = XMLHelper::getNextSiblingElement(e, RetryOnError);
     while (e) {
         if (e->hasChildNodes()) {
-            m_retries.push_back(XMLString::parseInt(e->getTextContent()));
-            m_log.info("will retry operations when native ODBC error (%ld) is returned", m_retries.back());
+            try {
+                int code = XMLString::parseInt(e->getTextContent());
+                m_retries.push_back(code);
+                m_log.info("will retry operations when native ODBC error (%d) is returned", code);
+            }
+            catch (XMLException&) {
+                m_log.error("skipping non-numeric ODBC retry code");
+            }
         }
         e = XMLHelper::getNextSiblingElement(e, RetryOnError);
     }

Modified: branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp?rev=3923&r1=3922&r2=3923&view=diff
==============================================================================
--- branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp	(original)
+++ branches/REL_2/shibsp/impl/StorageServiceSessionCache.cpp	Sun Jul  5 15:13:04 2015
@@ -1860,10 +1860,16 @@
 
     // Load our configuration details...
     static const XMLCh cleanupInterval[] = UNICODE_LITERAL_15(c,l,e,a,n,u,p,I,n,t,e,r,v,a,l);
-    const XMLCh* tag=pcache->m_root ? pcache->m_root->getAttributeNS(nullptr, cleanupInterval) : nullptr;
+    const XMLCh* tag = pcache->m_root ? pcache->m_root->getAttributeNS(nullptr, cleanupInterval) : nullptr;
     int rerun_timer = 900;
     if (tag && *tag) {
-        rerun_timer = XMLString::parseInt(tag);
+        try {
+            rerun_timer = XMLString::parseInt(tag);
+        }
+        catch (XMLException&) {
+            pcache->m_log.error("cleanupInterval setting was not a numeric value");
+            rerun_timer = 0;
+        }
         if (rerun_timer <= 0)
             rerun_timer = 900;
     }



More information about the commits mailing list