diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-06-17 21:17:55 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-06-17 21:17:55 +0200 |
commit | 9b12ee6b394e046023b4836a2a5288db6ee32c3b (patch) | |
tree | 46a2ded2b285cb6786b1b94a7f285d82970ac8fb /cpp/src/Ice/PluginManagerI.cpp | |
parent | ICE-6605 Fixed android tests to work with Java 1.8 (diff) | |
download | ice-9b12ee6b394e046023b4836a2a5288db6ee32c3b.tar.bz2 ice-9b12ee6b394e046023b4836a2a5288db6ee32c3b.tar.xz ice-9b12ee6b394e046023b4836a2a5288db6ee32c3b.zip |
The communicator now catch exceptions raised by plugin initialize and raise PluginInitializationException instead
Diffstat (limited to 'cpp/src/Ice/PluginManagerI.cpp')
-rw-r--r-- | cpp/src/Ice/PluginManagerI.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index 33901a78cb7..e3186298a9c 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -86,7 +86,26 @@ Ice::PluginManagerI::initializePlugins() { for(PluginInfoList::iterator p = _plugins.begin(); p != _plugins.end(); ++p) { - p->plugin->initialize(); + try + { + p->plugin->initialize(); + } + catch(const Ice::PluginInitializationException&) + { + throw; + } + catch(const std::exception& ex) + { + ostringstream os; + os << "plugin `" << p->name << "' initialization failed:\n" << ex.what(); + throw PluginInitializationException(__FILE__, __LINE__, os.str()); + } + catch(...) + { + ostringstream os; + os << "plugin `" << p->name << "' initialization failed:\nunknown exception"; + throw PluginInitializationException(__FILE__, __LINE__, os.str()); + } initializedPlugins.push_back(p->plugin); } } @@ -420,7 +439,7 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St args = properties->parseCommandLineOptions(name, args); cmdArgs = properties->parseCommandLineOptions(name, cmdArgs); } - + PluginPtr plugin; PLUGIN_FACTORY factory = 0; DynamicLibraryPtr library; |