summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Exception.cpp11
-rw-r--r--cpp/src/Ice/PluginManagerI.cpp34
-rw-r--r--cpp/src/IceSSL/OpenSSLPluginI.cpp2
3 files changed, 35 insertions, 12 deletions
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index 55280eb7d14..a7bebba4031 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -310,6 +310,17 @@ Ice::CompressionNotSupportedException::ice_print(ostream& out) const
}
void
+Ice::PluginInitializationException::ice_print(ostream& out) const
+{
+ Exception::ice_print(out);
+ out << ":\nplug-in initialization failed";
+ if (!reason.empty())
+ {
+ out << ": " << reason;
+ }
+}
+
+void
Ice::PluginExistsException::ice_print(ostream& out) const
{
Exception::ice_print(out);
diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp
index bc84f54f6a4..c9e2f6c25a0 100644
--- a/cpp/src/Ice/PluginManagerI.cpp
+++ b/cpp/src/Ice/PluginManagerI.cpp
@@ -144,15 +144,15 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& entryPoint, co
DynamicLibrary::symbol_type sym = info.library->loadEntryPoint(entryPoint);
if (sym == 0)
{
- Error out(_instance->logger());
+ ostringstream out;
string msg = info.library->getErrorMessage();
- out << "PluginManager: unable to load entry point `" << entryPoint << "'";
+ out << "unable to load entry point `" << entryPoint << "'";
if (!msg.empty())
{
out << ": " + msg;
}
- SystemException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = out.str();
throw ex;
}
@@ -166,16 +166,28 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& entryPoint, co
}
catch (const Exception& ex)
{
- Error out(_instance->logger());
- out << "PluginManager: exception in entry point `" << entryPoint << "': " << ex.ice_name();
- throw;
+ //
+ // Do NOT propagate the exception from the entry point,
+ // because the library will be closed.
+ //
+ ostringstream out;
+ out << "exception in entry point `" << entryPoint << "'\n"
+ << "original exception:\n"
+ << ex;
+ PluginInitializationException e(__FILE__, __LINE__);
+ e.reason = out.str();
+ throw e;
}
catch (...)
{
- Error out(_instance->logger());
- out << "PluginManager: unknown exception in entry point `" << entryPoint << "'";
- SystemException e(__FILE__, __LINE__);
- e.error = 0;
+ //
+ // Do NOT propagate the exception from the entry point,
+ // because the library will be closed.
+ //
+ ostringstream out;
+ out << "unknown exception in entry point `" << entryPoint << "'\n";
+ PluginInitializationException e(__FILE__, __LINE__);
+ e.reason = out.str();
throw e;
}
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp
index d3c410cb76e..487091e25bc 100644
--- a/cpp/src/IceSSL/OpenSSLPluginI.cpp
+++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp
@@ -76,7 +76,7 @@ create(const CommunicatorPtr& communicator, const string& name, const StringSeq&
}
catch (...)
{
- plugin->__decRef();
+ Ice::PluginPtr ptr = plugin; // Reclaim the plug-in instance
throw;
}