From be3415b7e414dc63f63226ff93c1cb601a19c859 Mon Sep 17 00:00:00 2001 From: Russell Taylor <taylorrj@ornl.gov> Date: Tue, 21 Apr 2009 11:34:01 +0000 Subject: [PATCH] Catch a possible Poco exception which otherwise propagates uncaught and crashes Mantid. Log the offending statement and then ignores the property. Fixes #553. --- Code/Mantid/Kernel/src/ConfigService.cpp | 14 ++++++++++---- Code/Mantid/Kernel/test/ConfigServiceTest.h | 4 +--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Code/Mantid/Kernel/src/ConfigService.cpp b/Code/Mantid/Kernel/src/ConfigService.cpp index 006dbd6704f..bafe6232e15 100644 --- a/Code/Mantid/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Kernel/src/ConfigService.cpp @@ -101,10 +101,16 @@ namespace Mantid if( !m_pConf->hasProperty(*sitr) ) continue; std::string value(m_pConf->getString(*sitr)); - if( Poco::Path(value).isRelative() ) - { - m_mAbsolutePaths.insert(std::make_pair(*sitr, Poco::Path(execdir).resolve(value).toString())); - } + try { + if( Poco::Path(value).isRelative() ) + { + m_mAbsolutePaths.insert(std::make_pair(*sitr, Poco::Path(execdir).resolve(value).toString())); + } + } + catch (Poco::PathSyntaxException &ex) + { + g_log.error() << ex.what() << " in .properties file: " << value << std::endl; + } } } diff --git a/Code/Mantid/Kernel/test/ConfigServiceTest.h b/Code/Mantid/Kernel/test/ConfigServiceTest.h index f64bea6186c..6d7279a6661 100644 --- a/Code/Mantid/Kernel/test/ConfigServiceTest.h +++ b/Code/Mantid/Kernel/test/ConfigServiceTest.h @@ -127,9 +127,7 @@ public: TS_ASSERT_EQUALS(ConfigService::Instance().getString("mantid.thorax"), "1"); } - -private: - ConfigService *configSvc; + }; #endif /*MANTID_CONFIGSERVICETEST_H_*/ -- GitLab