Isolate nested failures.
authorcantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Tue, 8 May 2007 21:27:38 +0000 (21:27 +0000)
committercantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Tue, 8 May 2007 21:27:38 +0000 (21:27 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@302 de75baf8-a10c-0410-a50a-987c0e22f00f

xmltooling/security/impl/ChainingTrustEngine.cpp

index 1834aab..f94c234 100644 (file)
@@ -45,20 +45,20 @@ static const XMLCh type[] =                         UNICODE_LITERAL_4(t,y,p,e);
 
 ChainingTrustEngine::ChainingTrustEngine(const DOMElement* e) : OpenSSLTrustEngine(e) {
     Category& log=Category::getInstance(XMLTOOLING_LOGCAT".TrustEngine");
-    try {
-        e = e ? XMLHelper::getFirstChildElement(e, _TrustEngine) : NULL;
-        while (e) {
+    e = e ? XMLHelper::getFirstChildElement(e, _TrustEngine) : NULL;
+    while (e) {
+        try {
             auto_ptr_char temp(e->getAttributeNS(NULL,type));
             if (temp.get() && *temp.get()) {
                 log.info("building TrustEngine of type %s", temp.get());
-                m_engines.push_back(XMLToolingConfig::getConfig().TrustEngineManager.newPlugin(temp.get(), e));
+                TrustEngine* engine = XMLToolingConfig::getConfig().TrustEngineManager.newPlugin(temp.get(), e);
+                m_engines.push_back(engine);
             }
-            e = XMLHelper::getNextSiblingElement(e, _TrustEngine);
         }
-    }
-    catch (exception&) {
-        for_each(m_engines.begin(), m_engines.end(), xmltooling::cleanup<TrustEngine>());
-        throw;
+        catch (exception& ex) {
+            log.error("error building TrustEngine: %s", ex.what());
+        }
+        e = XMLHelper::getNextSiblingElement(e, _TrustEngine);
     }
 }