Commit 2375a936 authored by Julien Michel's avatar Julien Michel

BUG: Removing exception from constructor and moving it to the GetParameter()...

BUG: Removing exception from constructor and moving it to the GetParameter() method, whose calls should be protected inside a try/catch block
parent b12bdf88
......@@ -16,6 +16,7 @@
=========================================================================*/
#include "otbConfigurationFile.h"
#include "otbMacro.h"
namespace otb
{
......@@ -25,6 +26,8 @@ ConfigurationFile::Pointer ConfigurationFile::Instance = NULL;
ConfigurationFile
::ConfigurationFile()
{
m_OTBConfig = NULL;
std::string OTBBinDir(OTB_CONFIG);
try
{
......@@ -32,7 +35,7 @@ ConfigurationFile
}
catch (ConfigFile::file_not_found& e)
{
itkExceptionMacro(<< "Error - File '" << e.filename << "' not found.");
otbMsgDebugMacro(<< "Error - File '" << e.filename << "' not found.");
}
}
......
......@@ -57,7 +57,13 @@ namespace otb
/** Get parameter*/
template<typename T> T GetParameter(const std::string & key) const {
try
if(m_OTBConfig == NULL)
{
itkExceptionMacro(<<"Configuration file not found.");
}
try
{
return m_OTBConfig->read<T>( key );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment