root.setPriority(Priority::FATAL);
root.setAppender(new OstreamAppender("default",&cerr));
+#ifdef _DEBUG
saml::NDC ndc("init");
+#endif
Category& log = Category::getInstance("shibtarget.STConfig");
if (!schemadir || !config) {
}
catch (...) {
log.fatal("caught exception while loading/initializing configuration");
- delete m_ini;
- delete m_rpcpool;
- shibConf.term();
- samlConf.term();
+ shutdown();
return false;
}
#endif
void STConfig::shutdown()
{
+#ifdef _DEBUG
saml::NDC ndc("shutdown");
+#endif
Category& log = Category::getInstance("shibtarget.STConfig");
log.info("shutting down the library");
delete m_rpcpool;
IConfig* STConfig::ShibTargetConfigFactory(const DOMElement* e)
{
- XMLConfig* ret=new XMLConfig(e);
- try {
- ret->getImplementation();
- }
- catch (...) {
- delete ret;
- throw;
- }
- return ret;
+ auto_ptr<XMLConfig> ret(new XMLConfig(e));
+ ret->getImplementation();
+ return ret.release();
}
XMLPropertySet::~XMLPropertySet()
void XMLPropertySet::load(const DOMElement* e, Category& log, DOMNodeFilter* filter)
{
- NDC ndc("load");
+#ifdef _DEBUG
+ saml::NDC ndc("load");
+#endif
m_root=e;
// Process each attribute as a property.
XMLApplication::XMLApplication(const IConfig* ini, const Iterator<ICredentials*>& creds, const DOMElement* e, const XMLApplication* base)
: m_ini(ini), m_base(base), m_profile(NULL), m_binding(NULL), m_bindingHook(NULL)
{
+#ifdef _DEBUG
NDC ndc("XMLApplication");
+#endif
Category& log=Category::getInstance("shibtarget.XMLApplication");
try {
bptr->addHook(m_bindingHook,m_bindingHook); // the hook is its own global context
}
}
+ catch (SAMLException& e) {
+ log.errorStream() << "Error while processing applicaton element: " << e.what() << CategoryStream::ENDLINE;
+ this->~XMLApplication();
+ throw;
+ }
+#ifndef _DEBUG
catch (...) {
- this->~XMLApplication(); // does this work?
+ log.error("Unexpected error while processing application element");
+ this->~XMLApplication();
throw;
}
+#endif
}
XMLApplication::~XMLApplication()
void XMLConfigImpl::init(bool first)
{
- NDC ndc("XMLConfigImpl");
+#ifdef _DEBUG
+ saml::NDC ndc("XMLConfigImpl");
+#endif
Category& log=Category::getInstance("shibtarget.XMLConfig");
try {
}
}
catch (SAMLException& e) {
- log.errorStream() << "Error while loading target configuration: " << e.what() << CategoryStream::ENDLINE;
+ log.errorStream() << "Error while loading SP configuration: " << e.what() << CategoryStream::ENDLINE;
this->~XMLConfigImpl();
throw;
}
#ifndef _DEBUG
catch (...) {
- log.error("Unexpected error while loading target configuration");
+ log.error("Unexpected error while loading SP configuration");
this->~XMLConfigImpl();
throw;
}