Quellcode durchsuchen

Use ctkException as the base exception class in the PluginFW.

Sascha Zelzer vor 13 Jahren
Ursprung
Commit
6efcf6a000
58 geänderte Dateien mit 434 neuen und 349 gelöschten Zeilen
  1. 0 1
      Libs/PluginFramework/CMakeLists.txt
  2. 3 3
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp
  3. 4 4
      Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationAdminTestSuite.cpp
  4. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp
  5. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite_p.h
  6. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite.cpp
  7. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite_p.h
  8. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite.cpp
  9. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite_p.h
  10. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite.cpp
  11. 1 1
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite_p.h
  12. 3 3
      Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp
  13. 3 3
      Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp
  14. 15 15
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp
  15. 4 4
      Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceListenerTestSuite.cpp
  16. 20 14
      Libs/PluginFramework/ctkLDAPExpr.cpp
  17. 0 2
      Libs/PluginFramework/ctkLDAPExpr_p.h
  18. 1 8
      Libs/PluginFramework/ctkLDAPSearchFilter.cpp
  19. 8 8
      Libs/PluginFramework/ctkPlugin.cpp
  20. 2 2
      Libs/PluginFramework/ctkPluginContext.cpp
  21. 27 7
      Libs/PluginFramework/ctkPluginDatabaseException.cpp
  22. 18 8
      Libs/PluginFramework/ctkPluginDatabaseException.h
  23. 24 7
      Libs/PluginFramework/ctkPluginException.cpp
  24. 25 8
      Libs/PluginFramework/ctkPluginException.h
  25. 1 1
      Libs/PluginFramework/ctkPluginFrameworkContext.cpp
  26. 3 1
      Libs/PluginFramework/ctkPluginFrameworkEvent.cpp
  27. 2 3
      Libs/PluginFramework/ctkPluginFrameworkEvent.h
  28. 8 2
      Libs/PluginFramework/ctkPluginFrameworkListeners.cpp
  29. 1 1
      Libs/PluginFramework/ctkPluginFrameworkListeners_p.h
  30. 6 4
      Libs/PluginFramework/ctkPluginFrameworkPrivate.cpp
  31. 23 14
      Libs/PluginFramework/ctkPluginPrivate.cpp
  32. 3 3
      Libs/PluginFramework/ctkPluginStorageSQL.cpp
  33. 8 4
      Libs/PluginFramework/ctkPlugins.cpp
  34. 1 1
      Libs/PluginFramework/ctkRequirePlugin.cpp
  35. 0 83
      Libs/PluginFramework/ctkRuntimeException.cpp
  36. 0 66
      Libs/PluginFramework/ctkRuntimeException.h
  37. 27 7
      Libs/PluginFramework/ctkServiceException.cpp
  38. 25 9
      Libs/PluginFramework/ctkServiceException.h
  39. 3 3
      Libs/PluginFramework/ctkServiceReference.cpp
  40. 8 10
      Libs/PluginFramework/ctkServiceReferencePrivate.cpp
  41. 2 3
      Libs/PluginFramework/ctkServiceRegistration.cpp
  42. 3 2
      Libs/PluginFramework/ctkServiceSlotEntry.cpp
  43. 4 4
      Libs/PluginFramework/ctkServices.cpp
  44. 9 9
      Libs/PluginFramework/ctkVersion.cpp
  45. 26 1
      Libs/PluginFramework/service/cm/ctkConfigurationException.cpp
  46. 24 3
      Libs/PluginFramework/service/cm/ctkConfigurationException.h
  47. 2 1
      Libs/PluginFramework/service/log/ctkLogEntry.h
  48. 1 1
      Plugins/org.commontk.eventadmin/adapter/ctkEAFrameworkEventAdapter.cpp
  49. 1 1
      Plugins/org.commontk.eventadmin/adapter/ctkEAPluginEventAdapter.cpp
  50. 1 1
      Plugins/org.commontk.eventadmin/adapter/ctkEAServiceEventAdapter.cpp
  51. 14 0
      Plugins/org.commontk.eventadmin/dispatch/ctkEAInterruptedException.cpp
  52. 7 1
      Plugins/org.commontk.eventadmin/dispatch/ctkEAInterruptedException_p.h
  53. 2 2
      Plugins/org.commontk.eventadmin/dispatch/ctkEALinkedQueue.cpp
  54. 14 0
      Plugins/org.commontk.eventadmin/util/ctkEABrokenBarrierException.cpp
  55. 13 1
      Plugins/org.commontk.eventadmin/util/ctkEABrokenBarrierException_p.h
  56. 1 1
      Plugins/org.commontk.eventadmin/util/ctkEACyclicBarrier.cpp
  57. 14 0
      Plugins/org.commontk.eventadmin/util/ctkEATimeoutException.cpp
  58. 12 1
      Plugins/org.commontk.eventadmin/util/ctkEATimeoutException_p.h

+ 0 - 1
Libs/PluginFramework/CMakeLists.txt

@@ -59,7 +59,6 @@ set(KIT_SRCS
   ctkPluginTrackerPrivate.tpp
   ctkRequirePlugin.cpp
   ctkRequirePlugin_p.h
-  ctkRuntimeException.cpp
   ctkServiceEvent.cpp
   ctkServiceException.cpp
   ctkServiceFactory.h

+ 3 - 3
Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp

@@ -39,8 +39,8 @@ void ctkConfigAdminTestActivator::start(ctkPluginContext* context)
   QString symbolicName = context->getProperty("cm.impl").toString();
   if (symbolicName.isEmpty())
   {
-    throw std::logic_error("Framework property 'cm.impl' containing the symbolic "
-                           "name of the ConfigAdmin implementation not found!");
+    throw ctkRuntimeException("Framework property 'cm.impl' containing the symbolic "
+                              "name of the ConfigAdmin implementation not found!");
   }
 
   long cmPluginId = -1;
@@ -57,7 +57,7 @@ void ctkConfigAdminTestActivator::start(ctkPluginContext* context)
   {
     QString msg = QString("The ConfigAdmin implementation '%1' is not installed.")
         .arg(symbolicName);
-    throw std::logic_error(msg.toStdString());
+    throw ctkRuntimeException(msg);
   }
 
   ctkDictionary props;

+ 4 - 4
Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigurationAdminTestSuite.cpp

@@ -67,7 +67,7 @@ void ctkConfigurationAdminTestSuite::testCreateConfigNullPid()
   {
     cm->getConfiguration(QString());
   }
-  catch (const std::invalid_argument& )
+  catch (const ctkException& )
   {
     return;
   }
@@ -88,7 +88,7 @@ void ctkConfigurationAdminTestSuite::testCreateConfigNullPidWithLocation()
   {
     cm->getConfiguration(QString(), QString());
   }
-  catch (const std::invalid_argument& )
+  catch (const ctkException& )
   {
     return;
   }
@@ -131,7 +131,7 @@ void ctkConfigurationAdminTestSuite::testCreateFactoryConfigNullPid()
   {
     cm->createFactoryConfiguration(QString());
   }
-  catch (const std::invalid_argument& )
+  catch (const ctkException& )
   {
     return;
   }
@@ -152,7 +152,7 @@ void ctkConfigurationAdminTestSuite::testCreateFactoryConfigNullPidWithLocation(
   {
     cm->createFactoryConfiguration(QString(), QString());
   }
-  catch (const std::invalid_argument& )
+  catch (const ctkException& )
   {
     return;
   }

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp

@@ -94,7 +94,7 @@ void ctkEAScenario1EventConsumer::cleanup()
       serviceRegistration.unregister();
     }
   }
-  catch (const std::logic_error&)
+  catch (const ctkException&)
   {}
 
   if (error)

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite_p.h

@@ -29,7 +29,7 @@
 #include <service/event/ctkEventHandler.h>
 #include <ctkTestSuiteInterface.h>
 #include <ctkServiceRegistration.h>
-#include <ctkRuntimeException.h>
+#include <ctkException.h>
 
 class ctkPluginContext;
 struct ctkEventAdmin;

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite.cpp

@@ -62,7 +62,7 @@ void ctkEAScenario2EventConsumer::cleanup()
   {
     serviceRegistration.unregister();
   }
-  catch (const std::logic_error&)
+  catch (const ctkIllegalStateException&)
   {}
 
   if (error)

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario2TestSuite_p.h

@@ -30,7 +30,7 @@
 #include <service/event/ctkEventHandler.h>
 #include <ctkTestSuiteInterface.h>
 #include <ctkServiceRegistration.h>
-#include <ctkRuntimeException.h>
+#include <ctkException.h>
 
 struct ctkEventAdmin;
 

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite.cpp

@@ -63,7 +63,7 @@ void ctkEAScenario3EventConsumer::cleanup()
   {
     serviceRegistration.unregister();
   }
-  catch (const std::logic_error&) {}
+  catch (const ctkIllegalStateException&) {}
 
   if (error)
   {

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario3TestSuite_p.h

@@ -30,7 +30,7 @@
 #include <service/event/ctkEventHandler.h>
 #include <ctkTestSuiteInterface.h>
 #include <ctkServiceRegistration.h>
-#include <ctkRuntimeException.h>
+#include <ctkException.h>
 
 struct ctkEventAdmin;
 

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite.cpp

@@ -69,7 +69,7 @@ void ctkEAScenario4EventConsumer::cleanup()
   {
     serviceRegistration.unregister();
   }
-  catch (const std::logic_error&) {}
+  catch (const ctkIllegalStateException&) {}
 
   if (error)
   {

+ 1 - 1
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario4TestSuite_p.h

@@ -27,10 +27,10 @@
 #include <QThread>
 #include <QMutex>
 
+#include <ctkException.h>
 #include <service/event/ctkEventHandler.h>
 #include <ctkTestSuiteInterface.h>
 #include <ctkServiceRegistration.h>
-#include <ctkRuntimeException.h>
 
 struct ctkEventAdmin;
 

+ 3 - 3
Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp

@@ -57,8 +57,8 @@ void ctkEventAdminTestActivator::start(ctkPluginContext* context)
   QString symbolicName = context->getProperty("event.impl").toString();
   if (symbolicName.isEmpty())
   {
-    throw std::logic_error("Framework property 'event.impl' containing the symbolic "
-                           "name of the EventAdmin implementation not found!");
+    throw ctkRuntimeException("Framework property 'event.impl' containing the symbolic "
+                              "name of the EventAdmin implementation not found!");
   }
 
   long eventPluginId = -1;
@@ -75,7 +75,7 @@ void ctkEventAdminTestActivator::start(ctkPluginContext* context)
   {
     QString msg = QString("The EventAdmin implementation '%1' is not installed.")
         .arg(symbolicName);
-    throw std::logic_error(msg.toStdString());
+    throw ctkRuntimeException(msg);
   }
 
   topicWildcardTestSuite = new ctkEATopicWildcardTestSuite(context, eventPluginId, false);

+ 3 - 3
Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp

@@ -36,8 +36,8 @@ void ctkMetaTypeTestActivator::start(ctkPluginContext* context)
   QString symbolicName = context->getProperty("metatype.impl").toString();
   if (symbolicName.isEmpty())
   {
-    throw std::logic_error("Framework property 'metatype.impl' containing the symbolic "
-                           "name of the MetaType implementation not found!");
+    throw ctkRuntimeException("Framework property 'metatype.impl' containing the symbolic "
+                              "name of the MetaType implementation not found!");
   }
 
   long mtPluginId = -1;
@@ -54,7 +54,7 @@ void ctkMetaTypeTestActivator::start(ctkPluginContext* context)
   {
     QString msg = QString("The MetaType implementation '%1' is not installed.")
         .arg(symbolicName);
-    throw std::logic_error(msg.toStdString());
+    throw ctkRuntimeException(msg);
   }
 
   ctkDictionary props;

+ 15 - 15
Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp

@@ -60,7 +60,7 @@ void ctkPluginFrameworkTestSuite::initTestCase()
       QFAIL("plugin framework test suite: SETUP:FAIL");
     }
   }
-  catch (const std::logic_error& e)
+  catch (const ctkException& e)
   {
     QString msg  = QString("plugin framework test suite ") + e.what() + ": SETUP:FAIL";
     QFAIL(msg.toAscii());
@@ -74,7 +74,7 @@ void ctkPluginFrameworkTestSuite::initTestCase()
       QFAIL("plugin framework test suite: SETUP:FAIL");
     }
   }
-  catch (const std::logic_error& e)
+  catch (const ctkException& e)
   {
     QString msg  = QString("plugin framework test suite ") + e.what() + ": SETUP:FAIL";
     QFAIL(msg.toAscii());
@@ -88,7 +88,7 @@ void ctkPluginFrameworkTestSuite::initTestCase()
       QFAIL("plugin framework test suite: SETUP:FAIL");
     }
   }
-  catch (const std::logic_error& e)
+  catch (const ctkException& e)
   {
     QString msg  = QString("plugin framework test suite ") + e.what() + ": SETUP:FAIL";
     QFAIL(msg.toAscii());
@@ -98,7 +98,7 @@ void ctkPluginFrameworkTestSuite::initTestCase()
   {
     pc->connectServiceListener(this, "serviceListener");
   }
-  catch (const std::logic_error& e)
+  catch (const ctkException& e)
   {
     QString msg  = QString("plugin framework test suite ") + e.what() + ": SETUP:FAIL";
     QFAIL(msg.toAscii());
@@ -189,14 +189,14 @@ void ctkPluginFrameworkTestSuite::frame018a()
   try
   {
     QObject* obj = pc->getService(ctkServiceReference());
-    qDebug() << "Got service object =" << obj->metaObject()->className() << ", excpected std::invalid_argument exception";
-    QFAIL("Got service object, excpected std::invalid_argument exception");
+    qDebug() << "Got service object =" << obj->metaObject()->className() << ", excpected ctkInvalidArgumentException exception";
+    QFAIL("Got service object, excpected ctkInvalidArgumentException exception");
   }
-  catch (const std::invalid_argument& )
+  catch (const ctkInvalidArgumentException& )
   {}
   catch (...)
   {
-    QFAIL("Got wrong exception, expected std::invalid_argument");
+    QFAIL("Got wrong exception, expected ctkInvalidArgumentException");
   }
 }
 
@@ -253,7 +253,7 @@ void ctkPluginFrameworkTestSuite::frame025b()
     QString failMsg = QString("Unexpected plugin exception: ") + pexcA.what();
     QFAIL(failMsg.toStdString().c_str());
   }
-  catch (const std::logic_error& le)
+  catch (const std::exception& le)
   {
     QString failMsg = QString("Start plugin exception: ") + le.what();
     QFAIL(failMsg.toStdString().c_str());
@@ -270,7 +270,7 @@ void ctkPluginFrameworkTestSuite::frame025b()
     {
       QVERIFY2(pc->ungetService(sr1), "Service unget should return true");
     }
-    catch (const std::logic_error le)
+    catch (const std::exception& le)
     {
       QString failMsg = QString("Unget service exception: ") + le.what();
       QFAIL(failMsg.toStdString().c_str());
@@ -310,9 +310,9 @@ void ctkPluginFrameworkTestSuite::frame030b()
     pA->stop();
     QVERIFY2(pA->getState() == ctkPlugin::RESOLVED, "pluginA should be RESOLVED");
   }
-  catch (const std::logic_error& ise)
+  catch (const ctkIllegalStateException& ise)
   {
-    qDebug() << "Unexpected logic_error exception:" << ise.what();
+    qDebug() << "Unexpected ctkIllegalStateException exception:" << ise.what();
     QFAIL("framework test plugin, stop plugin pluginA");
   }
   catch (const ctkPluginException& pe)
@@ -346,9 +346,9 @@ void ctkPluginFrameworkTestSuite::frame035b()
     QVERIFY2(pA->getState() == ctkPlugin::UNINSTALLED,
              "pluginA_test should be UNINSTALLED");
   }
-  catch (const std::logic_error& ise)
+  catch (const ctkIllegalStateException& ise)
   {
-    qDebug() << "Unexpected logic_error exception:" << ise.what();
+    qDebug() << "Unexpected ctkIllegalStateException exception:" << ise.what();
     QFAIL("framework test plugin, uninstall");
   }
   catch (const ctkPluginException& pe)
@@ -445,7 +445,7 @@ void ctkPluginFrameworkTestSuite::frame045a()
   {
     pc->connectServiceListener(&sListen1, "serviceChanged", brokenFilter);
   }
-  catch (const std::invalid_argument& /*ia*/)
+  catch (const ctkInvalidArgumentException& /*ia*/)
   {
     //assertEquals("InvalidSyntaxException.getFilter should be same as input string", brokenFilter, ise.getFilter());
   }

+ 4 - 4
Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkServiceListenerTestSuite.cpp

@@ -97,7 +97,7 @@ void ctkServiceListenerTestSuite::frameSL25a()
   {
     pc->connectServiceListener(&sListen, "serviceChanged");
   }
-  catch (const std::logic_error& ise)
+  catch (const ctkIllegalStateException& ise)
   {
     qDebug() << "service listener registration failed " << ise.what();
     QFAIL("service listener registration failed");
@@ -309,7 +309,7 @@ void ctkServiceListenerTestSuite::frameSL25a()
     //pc->disconnectServiceListener(&sListen, "serviceChanged");
     sListen.clearEvents();
   } 
-  catch (const std::logic_error& ise)
+  catch (const ctkIllegalStateException& ise)
   {
     qDebug() << ise.what();
     QFAIL("service listener removal failed ");
@@ -330,7 +330,7 @@ bool ctkServiceListenerTestSuite::runStartStopTest(
     {
       pc->connectServiceListener(&sListen, "serviceChanged");
     }
-    catch (const std::logic_error& ise)
+    catch (const ctkIllegalStateException& ise)
     {
       teststatus  = false;
       qDebug() << "service listener registration failed " << ise.what()
@@ -390,7 +390,7 @@ bool ctkServiceListenerTestSuite::runStartStopTest(
       teststatus &= sListen.teststatus;
       sListen.clearEvents();
     }
-    catch (const std::logic_error& ise)
+    catch (const ctkIllegalStateException& ise)
     {
       teststatus  = false;
       qDebug() << "service listener removal failed " << ise.what()

+ 20 - 14
Libs/PluginFramework/ctkLDAPExpr.cpp

@@ -20,10 +20,15 @@ limitations under the License.
 =============================================================================*/
 
 #include "ctkLDAPExpr_p.h"
+
+#include <ctkException.h>
+
 #include <QSet>
 #include <QVariant>
 #include <QStringList>
 
+#include <stdexcept>
+
 const int ctkLDAPExpr::AND     =  0;
 const int ctkLDAPExpr::OR      =  1;
 const int ctkLDAPExpr::NOT     =  2;
@@ -53,7 +58,7 @@ private:
 
 public:
 
-  ParseState(const QString &str) throw (std::invalid_argument);
+  ParseState(const QString &str);
 
   //! Move m_pos to remove the prefix \a pre
   bool prefix(const QString &pre);
@@ -79,7 +84,7 @@ public:
   QString getAttributeValue();
 
   //! Throw InvalidSyntaxException exception
-  void error(const QString &m) const throw (std::invalid_argument);
+  void error(const QString &m) const;
 
 };
 
@@ -130,22 +135,23 @@ ctkLDAPExpr::ctkLDAPExpr()
 ctkLDAPExpr::ctkLDAPExpr( const QString &filter )
 {
   ParseState ps(filter);
+
+  ctkLDAPExpr expr;
   try
   {
-    ctkLDAPExpr expr = parseExpr(ps);
- 
-    if (!ps.rest().trimmed().isEmpty())
-    {
-      ps.error(GARBAGE + " '" + ps.rest() + "'");
-    }
-
-    d = expr.d;
-
+    expr = parseExpr(ps);
   }
   catch (const std::out_of_range&)
   {
     ps.error(EOS);
   }
+ 
+  if (!ps.rest().trimmed().isEmpty())
+  {
+    ps.error(GARBAGE + " '" + ps.rest() + "'");
+  }
+
+  d = expr.d;
 }
 
 //----------------------------------------------------------------------------
@@ -547,7 +553,7 @@ const QString ctkLDAPExpr::toString() const
 }
 
 //----------------------------------------------------------------------------
-ctkLDAPExpr::ParseState::ParseState( const QString &str ) throw (std::invalid_argument)
+ctkLDAPExpr::ParseState::ParseState( const QString &str )
 {
   if (str.isEmpty())
   {
@@ -648,8 +654,8 @@ QString ctkLDAPExpr::ParseState::getAttributeValue()
 }
 
 //----------------------------------------------------------------------------
-void ctkLDAPExpr::ParseState::error( const QString &m ) const throw (std::invalid_argument)
+void ctkLDAPExpr::ParseState::error( const QString &m ) const
 {
   QString error = m + ": " + (m_str.isNull() ? "" : m_str.mid(m_pos) );
-  throw std::invalid_argument( error.toStdString() );
+  throw ctkInvalidArgumentException(error);
 }

+ 0 - 2
Libs/PluginFramework/ctkLDAPExpr_p.h

@@ -31,8 +31,6 @@ limitations under the License.
 #include <QVector>
 #include <QStringList>
 
-#include <stdexcept>
-
 class ctkLDAPExprData;
 
 /**

+ 1 - 8
Libs/PluginFramework/ctkLDAPSearchFilter.cpp

@@ -53,14 +53,7 @@ ctkLDAPSearchFilter::ctkLDAPSearchFilter()
 ctkLDAPSearchFilter::ctkLDAPSearchFilter(const QString& filter)
   : d(0)
 {
-  try
-  {
-    d = new ctkLDAPSearchFilterData(filter);
-  }
-  catch (const std::exception& e)
-  {
-    throw std::invalid_argument(e.what());
-  }
+  d = new ctkLDAPSearchFilterData(filter);
 }
 
 //----------------------------------------------------------------------------

+ 8 - 8
Libs/PluginFramework/ctkPlugin.cpp

@@ -42,7 +42,7 @@ ctkPlugin::ctkPlugin()
 //----------------------------------------------------------------------------
 void ctkPlugin::init(ctkPluginPrivate* dd)
 {
-  if (d_ptr) throw std::logic_error("ctkPlugin already initialized");
+  if (d_ptr) throw ctkIllegalStateException("ctkPlugin already initialized");
   d_ptr = dd;
 }
 
@@ -51,7 +51,7 @@ void ctkPlugin::init(const QWeakPointer<ctkPlugin>& self,
                      ctkPluginFrameworkContext* fw,
                      QSharedPointer<ctkPluginArchive> pa)
 {
-  if (d_ptr) throw std::logic_error("ctkPlugin already initialized");
+  if (d_ptr) throw ctkIllegalStateException("ctkPlugin already initialized");
   d_ptr = new ctkPluginPrivate(self, fw, pa);
 }
 
@@ -190,13 +190,13 @@ void ctkPlugin::update(const QUrl& updateLocation)
   case STARTING:
     // Wait for RUNNING state, this doesn't happen now
     // since we are synchronized.
-    throw std::logic_error("Plugin is in STARTING state");
+    throw ctkIllegalStateException("Plugin is in STARTING state");
   case STOPPING:
     // Wait for RESOLVED state, this doesn't happen now
     // since we are synchronized.
-    throw std::logic_error("Plugin is in STOPPING state");
+    throw ctkIllegalStateException("Plugin is in STOPPING state");
   case UNINSTALLED:
-    throw std::logic_error("Plugin is in UNINSTALLED state");
+    throw ctkIllegalStateException("Plugin is in UNINSTALLED state");
   }
 }
 
@@ -235,12 +235,12 @@ void ctkPlugin::uninstall()
           exception = d->stop0();
         }
       }
-      catch (const std::exception& e)
+      catch (const ctkException& e)
       {
         // Force to install
         d->setStateInstalled(false);
         d->operationLock.wakeAll();
-        exception = new ctkRuntimeException("Stopping plug-in failed", &e);
+        exception = new ctkRuntimeException("Stopping plug-in failed", e);
       }
       d->operation.fetchAndStoreOrdered(ctkPluginPrivate::UNINSTALLING);
       if (exception != 0)
@@ -292,7 +292,7 @@ void ctkPlugin::uninstall()
       {
         if (!ctk::removeDirRecursively(d->pluginDir.absolutePath()))
         {
-          d->fwCtx->listeners.frameworkError(this->d_func()->q_func(), std::runtime_error("Failed to delete plugin data"));
+          d->fwCtx->listeners.frameworkError(this->d_func()->q_func(), ctkRuntimeException("Failed to delete plugin data"));
         }
         d->pluginDir.setFile("");
       }

+ 2 - 2
Libs/PluginFramework/ctkPluginContext.cpp

@@ -159,7 +159,7 @@ QObject* ctkPluginContext::getService(const ctkServiceReference& reference)
 
   if (!reference)
   {
-    throw std::invalid_argument("Default constructed ctkServiceReference is not a valid input to getService()");
+    throw ctkInvalidArgumentException("Default constructed ctkServiceReference is not a valid input to getService()");
   }
   ctkServiceReference internalRef(reference);
   return internalRef.d_func()->getService(d->plugin->q_func());
@@ -191,7 +191,7 @@ bool ctkPluginContext::connectPluginListener(const QObject* receiver, const char
   }
   else
   {
-    throw std::invalid_argument("Only Qt::DirectConnection, Qt::QueuedConnection, or Qt::BlockingQueuedConnection are allowed as type argument.");
+    throw ctkInvalidArgumentException("Only Qt::DirectConnection, Qt::QueuedConnection, or Qt::BlockingQueuedConnection are allowed as type argument.");
   }
 }
 

+ 27 - 7
Libs/PluginFramework/ctkPluginDatabaseException.cpp

@@ -24,7 +24,16 @@
 #include <QDebug>
 
 //----------------------------------------------------------------------------
-ctkPluginDatabaseException::ctkPluginDatabaseException(const QString& msg, const Type& type, const std::exception* cause)
+ctkPluginDatabaseException::ctkPluginDatabaseException(const QString& msg, const Type& type)
+  : ctkRuntimeException(msg),
+    type(type)
+{
+
+}
+
+//----------------------------------------------------------------------------
+ctkPluginDatabaseException::ctkPluginDatabaseException(const QString& msg, const Type& type,
+                                                       const ctkException& cause)
   : ctkRuntimeException(msg, cause),
     type(type)
 {
@@ -32,7 +41,8 @@ ctkPluginDatabaseException::ctkPluginDatabaseException(const QString& msg, const
 }
 
 //----------------------------------------------------------------------------
-ctkPluginDatabaseException::ctkPluginDatabaseException(const QString& msg, const std::exception* cause)
+ctkPluginDatabaseException::ctkPluginDatabaseException(const QString& msg,
+                                                       const ctkException& cause)
   : ctkRuntimeException(msg, cause),
     type(UNSPECIFIED)
 {
@@ -55,15 +65,25 @@ ctkPluginDatabaseException& ctkPluginDatabaseException::operator=(const ctkPlugi
 }
 
 //----------------------------------------------------------------------------
-ctkPluginDatabaseException::Type ctkPluginDatabaseException::getType() const
+ctkPluginDatabaseException::~ctkPluginDatabaseException() throw()
 {
-  return type;
+
 }
 
 //----------------------------------------------------------------------------
-QDebug operator<<(QDebug dbg, const ctkPluginDatabaseException& exc)
+const char* ctkPluginDatabaseException::name() const throw()
 {
-  dbg << "ctkPluginDatabaseException:" << exc.what();
+  return "ctkPluginDatabaseException";
+}
+
+//----------------------------------------------------------------------------
+ctkPluginDatabaseException* ctkPluginDatabaseException::clone() const
+{
+  return new ctkPluginDatabaseException(*this);
+}
 
-  return dbg.maybeSpace();
+//----------------------------------------------------------------------------
+ctkPluginDatabaseException::Type ctkPluginDatabaseException::getType() const
+{
+  return type;
 }

+ 18 - 8
Libs/PluginFramework/ctkPluginDatabaseException.h

@@ -22,7 +22,9 @@
 #ifndef CTKPLUGINDATABASEEXCEPTION_H
 #define CTKPLUGINDATABASEEXCEPTION_H
 
-#include "ctkRuntimeException.h"
+#include "ctkException.h"
+
+#include <ctkPluginFrameworkExport.h>
 
 /**
  * \ingroup PluginFramework
@@ -42,12 +44,25 @@ public:
     DB_SQL_ERROR
   };
 
-  ctkPluginDatabaseException(const QString& msg, const Type& type = UNSPECIFIED, const std::exception* cause = 0);
-  ctkPluginDatabaseException(const QString& msg, const std::exception* cause);
+  ctkPluginDatabaseException(const QString& msg, const Type& type = UNSPECIFIED);
+  ctkPluginDatabaseException(const QString& msg, const Type& type, const ctkException& cause);
+  ctkPluginDatabaseException(const QString& msg, const ctkException& cause);
 
   ctkPluginDatabaseException(const ctkPluginDatabaseException& o);
   ctkPluginDatabaseException& operator=(const ctkPluginDatabaseException& o);
 
+  ~ctkPluginDatabaseException() throw();
+
+  /**
+   * @see ctkException::name()
+   */
+  const char* name() const throw();
+
+  /**
+   * @see ctkException::clone()
+   */
+  ctkPluginDatabaseException* clone() const;
+
   Type getType() const;
 
 private:
@@ -56,9 +71,4 @@ private:
 
 };
 
-/**
- * \ingroup PluginFramework
- */
-CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkPluginDatabaseException& exc);
-
 #endif // CTKPLUGINDATABASEEXCEPTION_H

+ 24 - 7
Libs/PluginFramework/ctkPluginException.cpp

@@ -24,7 +24,15 @@
 #include <QDebug>
 
 //----------------------------------------------------------------------------
-ctkPluginException::ctkPluginException(const QString& msg, const Type& type, const std::exception* cause)
+ctkPluginException::ctkPluginException(const QString& msg, const Type& type)
+  : ctkRuntimeException(msg),
+    type(type)
+{
+
+}
+
+//----------------------------------------------------------------------------
+ctkPluginException::ctkPluginException(const QString& msg, const Type& type, const ctkException& cause)
   : ctkRuntimeException(msg, cause),
     type(type)
 {
@@ -32,7 +40,7 @@ ctkPluginException::ctkPluginException(const QString& msg, const Type& type, con
 }
 
 //----------------------------------------------------------------------------
-ctkPluginException::ctkPluginException(const QString& msg, const std::exception* cause)
+ctkPluginException::ctkPluginException(const QString& msg, const ctkException& cause)
   : ctkRuntimeException(msg, cause),
     type(UNSPECIFIED)
 {
@@ -55,15 +63,24 @@ ctkPluginException& ctkPluginException::operator=(const ctkPluginException& o)
 }
 
 //----------------------------------------------------------------------------
-ctkPluginException::Type ctkPluginException::getType() const
+ctkPluginException::~ctkPluginException() throw()
 {
-  return type;
 }
 
 //----------------------------------------------------------------------------
-QDebug operator<<(QDebug dbg, const ctkPluginException& exc)
+const char* ctkPluginException::name() const throw()
 {
-  dbg << "ctkPluginException:" << exc.what();
+  return "ctkPluginException";
+}
 
-  return dbg.maybeSpace();
+//----------------------------------------------------------------------------
+ctkPluginException* ctkPluginException::clone() const
+{
+  return new ctkPluginException(*this);
+}
+
+//----------------------------------------------------------------------------
+ctkPluginException::Type ctkPluginException::getType() const
+{
+  return type;
 }

+ 25 - 8
Libs/PluginFramework/ctkPluginException.h

@@ -22,7 +22,9 @@
 #ifndef CTKPLUGINEXCEPTION_H
 #define CTKPLUGINEXCEPTION_H
 
-#include "ctkRuntimeException.h"
+#include "ctkException.h"
+
+#include <ctkPluginFrameworkExport.h>
 
 /**
  * \ingroup PluginFramework
@@ -93,6 +95,14 @@ public:
   };
 
   /**
+   * Creates a <code>ctkPluginException</code> with the specified message and type.
+   *
+   * @param msg The associated message.
+   * @param type The type for this exception.
+   */
+  ctkPluginException(const QString& msg, const Type& type = UNSPECIFIED);
+
+  /**
    * Creates a <code>ctkPluginException</code> with the specified message, type
    * and exception cause.
    *
@@ -100,7 +110,7 @@ public:
    * @param type The type for this exception.
    * @param cause The cause of this exception.
    */
-  ctkPluginException(const QString& msg, const Type& type = UNSPECIFIED, const std::exception* cause = 0);
+  ctkPluginException(const QString& msg, const Type& type, const ctkException& cause);
 
   /**
    * Creates a <code>ctkPluginException</code> with the specified message and
@@ -109,11 +119,23 @@ public:
    * @param msg The associated message.
    * @param cause The cause of this exception.
    */
-  ctkPluginException(const QString& msg, const std::exception* cause);
+  ctkPluginException(const QString& msg, const ctkException& cause);
 
   ctkPluginException(const ctkPluginException& o);
   ctkPluginException& operator=(const ctkPluginException& o);
 
+  ~ctkPluginException() throw();
+
+  /**
+   * @see ctkException::name()
+   */
+  const char* name() const throw();
+
+  /**
+   * @see ctkException::clone()
+   */
+  ctkPluginException* clone() const;
+
   /**
    * Returns the type for this exception or <code>UNSPECIFIED</code> if the
    * type was unspecified or unknown.
@@ -131,9 +153,4 @@ private:
 
 };
 
-/**
- * \ingroup PluginFramework
- */
-CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkPluginException& exc);
-
 #endif // CTKPLUGINEXCEPTION_H

+ 1 - 1
Libs/PluginFramework/ctkPluginFrameworkContext.cpp

@@ -170,7 +170,7 @@ void ctkPluginFrameworkContext::checkOurPlugin(ctkPlugin* plugin) const
   ctkPluginPrivate* pp = plugin->d_func();
   if (this != pp->fwCtx)
   {
-    throw std::invalid_argument("ctkPlugin does not belong to this framework: " + plugin->getSymbolicName().toStdString());
+    throw ctkInvalidArgumentException("ctkPlugin does not belong to this framework: " + plugin->getSymbolicName());
   }
 }
 

+ 3 - 1
Libs/PluginFramework/ctkPluginFrameworkEvent.cpp

@@ -23,6 +23,8 @@
 
 #include "ctkPlugin.h"
 
+#include <ctkException.h>
+
 #include <QString>
 #include <QDebug>
 
@@ -79,7 +81,7 @@ bool ctkPluginFrameworkEvent::isNull() const
 }
 
 //----------------------------------------------------------------------------
-ctkPluginFrameworkEvent::ctkPluginFrameworkEvent(Type type, QSharedPointer<ctkPlugin> plugin, const std::exception& fwException)
+ctkPluginFrameworkEvent::ctkPluginFrameworkEvent(Type type, QSharedPointer<ctkPlugin> plugin, const ctkException &fwException)
   : d(new ctkPluginFrameworkEventData(type, plugin, fwException.what()))
 {
 

+ 2 - 3
Libs/PluginFramework/ctkPluginFrameworkEvent.h

@@ -28,8 +28,7 @@
 
 #include "ctkPluginFrameworkExport.h"
 
-#include <stdexcept>
-
+class ctkException;
 class ctkPlugin;
 class ctkPluginFrameworkEventData;
 
@@ -144,7 +143,7 @@ public:
    * @param plugin The event source.
    * @param fwException The related exception.
    */
-  ctkPluginFrameworkEvent(Type type, QSharedPointer<ctkPlugin> plugin, const std::exception& fwException);
+  ctkPluginFrameworkEvent(Type type, QSharedPointer<ctkPlugin> plugin, const ctkException& fwException);
 
   /**
    * Creates a Framework event regarding the specified plugin.

+ 8 - 2
Libs/PluginFramework/ctkPluginFrameworkListeners.cpp

@@ -21,6 +21,7 @@
 
 #include "ctkPluginFrameworkListeners_p.h"
 
+#include "ctkException.h"
 #include "ctkPluginFrameworkContext_p.h"
 #include "ctkPluginConstants.h"
 #include "ctkLDAPExpr_p.h"
@@ -153,7 +154,7 @@ QSet<ctkServiceSlotEntry> ctkPluginFrameworkListeners::getMatchingServiceSlots(
 }
 
 //----------------------------------------------------------------------------
-void ctkPluginFrameworkListeners::frameworkError(QSharedPointer<ctkPlugin> p, const std::exception& e)
+void ctkPluginFrameworkListeners::frameworkError(QSharedPointer<ctkPlugin> p, const ctkException& e)
 {
   emit frameworkEvent(ctkPluginFrameworkEvent(ctkPluginFrameworkEvent::PLUGIN_ERROR, p, e));
 }
@@ -214,10 +215,15 @@ void ctkPluginFrameworkListeners::serviceChanged(
       ++n;
       l.invokeSlot(evt);
     }
-    catch (const std::exception& pe)
+    catch (const ctkException& pe)
     {
       frameworkError(l.getPlugin(), pe);
     }
+    catch (const std::exception& e)
+    {
+      frameworkError(l.getPlugin(), ctkRuntimeException(e.what()));
+    }
+
     //break;
     //}
     //}

+ 1 - 1
Libs/PluginFramework/ctkPluginFrameworkListeners_p.h

@@ -82,7 +82,7 @@ public:
    * @param p Plugin which caused the error.
    * @param e The exception.
    */
-  void frameworkError(QSharedPointer<ctkPlugin> p, const std::exception& e);
+  void frameworkError(QSharedPointer<ctkPlugin> p, const ctkException& e);
 
   /**
    * Receive notification that a service has had a change occur in its lifecycle.

+ 6 - 4
Libs/PluginFramework/ctkPluginFrameworkPrivate.cpp

@@ -86,9 +86,10 @@ void ctkPluginFrameworkPrivate::shutdown(bool restart)
         shuttingDown.fetchAndStoreOrdered(1);
         QtConcurrent::run(this, &ctkPluginFrameworkPrivate::shutdown0, restart, wa);
       }
-      catch (const std::exception& e)
+      catch (const ctkException& e)
       {
-        systemShuttingdownDone(ctkPluginFrameworkEvent(ctkPluginFrameworkEvent::PLUGIN_ERROR, this->q_func(), e));
+        systemShuttingdownDone(ctkPluginFrameworkEvent(ctkPluginFrameworkEvent::PLUGIN_ERROR,
+                                                       this->q_func(), e));
       }
     }
     break;
@@ -138,10 +139,11 @@ void ctkPluginFrameworkPrivate::shutdown0(bool restart, bool wasActive)
       }
     }
   }
-  catch (const std::exception& e)
+  catch (const ctkException& e)
   {
     shuttingDown.fetchAndStoreOrdered(0);
-    systemShuttingdownDone(ctkPluginFrameworkEvent(ctkPluginFrameworkEvent::PLUGIN_ERROR, this->q_func(), e));
+    systemShuttingdownDone(ctkPluginFrameworkEvent(ctkPluginFrameworkEvent::PLUGIN_ERROR,
+                                                   this->q_func(), e));
   }
 }
 

+ 23 - 14
Libs/PluginFramework/ctkPluginPrivate.cpp

@@ -302,8 +302,8 @@ void ctkPluginPrivate::checkManifestHeaders()
 
   if (symbolicName.isEmpty())
   {
-    throw std::invalid_argument(std::string("ctkPlugin has no symbolic name, location=") +
-                                qPrintable(location));
+    throw ctkInvalidArgumentException(QString("ctkPlugin has no symbolic name, location=") +
+                                      location);
   }
 
   QString mpv = archive->getAttribute(ctkPluginConstants::PLUGIN_VERSION);
@@ -315,8 +315,8 @@ void ctkPluginPrivate::checkManifestHeaders()
     }
     catch (const std::exception& e)
     {
-      throw std::invalid_argument(std::string("ctkPlugin does not specify a valid ") +
-                                  qPrintable(ctkPluginConstants::PLUGIN_VERSION) + " header. Got exception: " + e.what());
+      throw ctkInvalidArgumentException(QString("ctkPlugin does not specify a valid ") +
+                                        ctkPluginConstants::PLUGIN_VERSION + " header. Got exception: " + e.what());
     }
   }
 
@@ -324,8 +324,8 @@ void ctkPluginPrivate::checkManifestHeaders()
   // TBD! Should we allow update to same version?
   if (!snp.isNull() && snp->d_func() != this)
   {
-    throw std::invalid_argument(std::string("Plugin with same symbolic name and version is already installed (")
-                                + symbolicName.toStdString() + ", " + version.toString().toStdString() + ")");
+    throw ctkInvalidArgumentException(QString("Plugin with same symbolic name and version is already installed (")
+                                      + symbolicName + ", " + version.toString() + ")");
   }
 
   QString ap = archive->getAttribute(ctkPluginConstants::PLUGIN_ACTIVATIONPOLICY);
@@ -441,10 +441,15 @@ const ctkRuntimeException* ctkPluginPrivate::stop1()
         }
       }
     }
-    catch (const std::exception& e)
+    catch (const ctkException& e)
+    {
+      res = new ctkPluginException("ctkPlugin::stop: PluginActivator stop failed",
+                                   ctkPluginException::ACTIVATOR_ERROR, e);
+    }
+    catch (...)
     {
       res = new ctkPluginException("ctkPlugin::stop: PluginActivator stop failed",
-                                              ctkPluginException::ACTIVATOR_ERROR, &e);
+                                   ctkPluginException::ACTIVATOR_ERROR);
     }
     pluginActivator = 0;
   }
@@ -529,7 +534,7 @@ void ctkPluginPrivate::update0(const QUrl& updateLocation, bool wasActive)
       }
       catch (const ctkPluginException& pe)
       {
-        fwCtx->listeners.frameworkError(this->q_func(), e);
+        fwCtx->listeners.frameworkError(this->q_func(), pe);
       }
     }
     try
@@ -539,8 +544,8 @@ void ctkPluginPrivate::update0(const QUrl& updateLocation, bool wasActive)
     }
     catch (std::bad_cast)
     {
-      throw ctkPluginException("Failed to get update plugin",
-                               ctkPluginException::UNSPECIFIED, &e);
+      throw ctkPluginException(QString("Failed to get update plugin: ") + e.what(),
+                               ctkPluginException::UNSPECIFIED);
     }
   }
 
@@ -752,9 +757,13 @@ ctkPluginException* ctkPluginPrivate::start0()
     }
     state = ctkPlugin::ACTIVE;
   }
-  catch (const std::exception& e)
+  catch (const ctkException& e)
+  {
+    res = new ctkPluginException("ctkPlugin start failed", error_type, e);
+  }
+  catch (...)
   {
-    res = new ctkPluginException("ctkPlugin start failed", error_type, &e);
+    res = new ctkPluginException("ctkPlugin start failed", error_type);
   }
 
   if (fwCtx->debug.lazy_activation)
@@ -796,7 +805,7 @@ void ctkPluginPrivate::removePluginResources()
     {
       i.next().unregister();
     }
-    catch (const std::logic_error& /*ignore*/)
+    catch (const ctkIllegalStateException& /*ignore*/)
     {
       // Someone has unregistered the service after stop completed.
       // This should not occur, but we don't want get stuck in

+ 3 - 3
Libs/PluginFramework/ctkPluginStorageSQL.cpp

@@ -366,7 +366,7 @@ QSharedPointer<ctkPluginArchive> ctkPluginStorageSQL::insertPlugin(const QUrl& l
   QFileInfo fileInfo(localPath);
   if (!fileInfo.exists())
   {
-    throw std::invalid_argument((localPath + " does not exist").toStdString());
+    throw ctkInvalidArgumentException(localPath + " does not exist");
   }
 
   const QString libTimestamp = getStringFromQDateTime(fileInfo.lastModified());
@@ -431,8 +431,8 @@ void ctkPluginStorageSQL::insertArchive(QSharedPointer<ctkPluginArchiveSQL> pa,
   pluginLoader.setFileName(pa->getLibLocation());
   if (!pluginLoader.load())
   {
-    ctkPluginException exc(QString("The plugin could not be loaded: %1").arg(pa->getLibLocation()));
-    exc.setCause(pluginLoader.errorString());
+    ctkPluginException exc(QString("The plugin \"%1\" could not be loaded: %2").arg(pa->getLibLocation())
+                           .arg(pluginLoader.errorString()));
     throw exc;
   }
 

+ 8 - 4
Libs/PluginFramework/ctkPlugins.cpp

@@ -105,7 +105,7 @@ QSharedPointer<ctkPlugin> ctkPlugins::install(const QUrl& location, QIODevice* i
 
         if (location.scheme() != "file")
         {
-          throw std::runtime_error(std::string("Unsupported url scheme: ") + qPrintable(location.scheme()));
+          throw ctkRuntimeException(QString("Unsupported url scheme: ") + location.scheme());
         }
         else
         {
@@ -123,7 +123,7 @@ QSharedPointer<ctkPlugin> ctkPlugins::install(const QUrl& location, QIODevice* i
       res->init(res, fwCtx, pa);
       plugins.insert(location.toString(), res);
     }
-    catch (const std::exception& e)
+    catch (const ctkException& e)
     {
       if (!pa.isNull())
       {
@@ -134,10 +134,14 @@ QSharedPointer<ctkPlugin> ctkPlugins::install(const QUrl& location, QIODevice* i
       //      }
       //      else
       //      {
-      throw ctkPluginException(QString("Failed to install plugin: ") + QString(e.what()),
-                               ctkPluginException::UNSPECIFIED, &e);
+      throw ctkPluginException("Failed to install plugin",
+                               ctkPluginException::UNSPECIFIED, e);
       //      }
     }
+    catch (...)
+    {
+      throw ctkPluginException("Failed to install plugin", ctkPluginException::UNSPECIFIED);
+    }
   }
 
   fwCtx->listeners.emitPluginChanged(ctkPluginEvent(ctkPluginEvent::INSTALLED, res));

+ 1 - 1
Libs/PluginFramework/ctkRequirePlugin.cpp

@@ -45,7 +45,7 @@ ctkRequirePlugin::ctkRequirePlugin(ctkPluginPrivate* requestor,
                    + ". The value must be either '"
                    + ctkPluginConstants::RESOLUTION_MANDATORY + "' or '"
                    + ctkPluginConstants::RESOLUTION_OPTIONAL  + "'.";
-    throw std::invalid_argument(what.toStdString());
+    throw ctkInvalidArgumentException(what);
     }
 
 

+ 0 - 83
Libs/PluginFramework/ctkRuntimeException.cpp

@@ -1,83 +0,0 @@
-/*=============================================================================
-
-  Library: CTK
-
-  Copyright (c) German Cancer Research Center,
-    Division of Medical and Biological Informatics
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=============================================================================*/
-
-
-#include "ctkRuntimeException.h"
-
-#include <QDebug>
-
-//----------------------------------------------------------------------------
-ctkRuntimeException::ctkRuntimeException(const QString& msg, const std::exception* cause)
-  : std::runtime_error(msg.toStdString())
-{
-  if (cause)
-  {
-    this->cause = QString(cause->what());
-  }
-}
-
-//----------------------------------------------------------------------------
-ctkRuntimeException::ctkRuntimeException(const ctkRuntimeException& o)
-  : std::runtime_error(o.what()), cause(o.cause)
-{
-
-}
-
-//----------------------------------------------------------------------------
-ctkRuntimeException& ctkRuntimeException::operator=(const ctkRuntimeException& o)
-{
-  std::runtime_error::operator=(o);
-  cause = o.cause;
-  return *this;
-}
-
-//----------------------------------------------------------------------------
-QString ctkRuntimeException::getCause() const
-{
-  return cause;
-}
-
-//----------------------------------------------------------------------------
-void ctkRuntimeException::setCause(const QString& cause)
-{
-  if (!this->cause.isEmpty()) throw std::logic_error("The cause for this ctkServiceException instance is already set");
-
-  this->cause = cause;
-}
-
-//----------------------------------------------------------------------------
-const char* ctkRuntimeException::what() const throw()
-{
-  static std::string fullMsg;
-  fullMsg = std::string(std::runtime_error::what());
-  QString causeMsg = getCause();
-  if (!causeMsg.isEmpty()) fullMsg += std::string("\n  Caused by: ") + causeMsg.toStdString();
-
-  return fullMsg.c_str();
-}
-
-//----------------------------------------------------------------------------
-QDebug operator<<(QDebug dbg, const ctkRuntimeException& exc)
-{
-  dbg << "ctkRuntimeException:" << exc.what();
-
-  return dbg.maybeSpace();
-}

+ 0 - 66
Libs/PluginFramework/ctkRuntimeException.h

@@ -1,66 +0,0 @@
-/*=============================================================================
-
-  Library: CTK
-
-  Copyright (c) German Cancer Research Center,
-    Division of Medical and Biological Informatics
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=============================================================================*/
-
-
-#ifndef CTKRUNTIMEEXCEPTION_H
-#define CTKRUNTIMEEXCEPTION_H
-
-#include <stdexcept>
-
-#include <QString>
-
-#include "ctkPluginFrameworkExport.h"
-
-/**
- * \ingroup PluginFramework
- */
-class CTK_PLUGINFW_EXPORT ctkRuntimeException : public std::runtime_error
-{
-public:
-
-  ctkRuntimeException(const QString& msg, const std::exception* cause = 0);
-  ctkRuntimeException(const ctkRuntimeException& o);
-
-  ctkRuntimeException& operator=(const ctkRuntimeException& o);
-
-  ~ctkRuntimeException() throw() {}
-
-  QString getCause() const;
-  void setCause(const QString& cause);
-
-  const char* what() const throw();
-
-private:
-
-  QString  cause;
-};
-
-/**
- * \ingroup PluginFramework
- */
-typedef ctkRuntimeException ctkIllegalStateException;
-
-/**
- * \ingroup PluginFramework
- */
-CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkRuntimeException& exc);
-
-#endif // CTKRUNTIMEEXCEPTION_H

+ 27 - 7
Libs/PluginFramework/ctkServiceException.cpp

@@ -24,7 +24,16 @@
 #include <QDebug>
 
 //----------------------------------------------------------------------------
-ctkServiceException::ctkServiceException(const QString& msg, const Type& type, const std::exception* cause)
+ctkServiceException::ctkServiceException(const QString& msg, const Type& type)
+  : ctkRuntimeException(msg),
+    type(type)
+{
+
+}
+
+//----------------------------------------------------------------------------
+ctkServiceException::ctkServiceException(const QString& msg, const Type& type,
+                                         const ctkException& cause)
   : ctkRuntimeException(msg, cause),
     type(type)
 {
@@ -32,7 +41,7 @@ ctkServiceException::ctkServiceException(const QString& msg, const Type& type, c
 }
 
 //----------------------------------------------------------------------------
-ctkServiceException::ctkServiceException(const QString& msg, const std::exception* cause)
+ctkServiceException::ctkServiceException(const QString& msg, const ctkException& cause)
   : ctkRuntimeException(msg, cause),
     type(UNSPECIFIED)
 {
@@ -55,15 +64,26 @@ ctkServiceException& ctkServiceException::operator=(const ctkServiceException& o
 }
 
 //----------------------------------------------------------------------------
-ctkServiceException::Type ctkServiceException::getType() const
+ctkServiceException::~ctkServiceException() throw()
 {
-  return type;
+
 }
 
 //----------------------------------------------------------------------------
-QDebug operator<<(QDebug dbg, const ctkServiceException& exc)
+const char* ctkServiceException::name() const throw()
 {
-  dbg << "ctkServiceException:" << exc.what();
+  return "ctkServiceException";
+}
 
-  return dbg.maybeSpace();
+//----------------------------------------------------------------------------
+ctkServiceException* ctkServiceException::clone() const
+{
+  return new ctkServiceException(*this);
 }
+
+//----------------------------------------------------------------------------
+ctkServiceException::Type ctkServiceException::getType() const
+{
+  return type;
+}
+

+ 25 - 9
Libs/PluginFramework/ctkServiceException.h

@@ -23,7 +23,9 @@
 #ifndef CTKSERVICEEXCEPTION_H
 #define CTKSERVICEEXCEPTION_H
 
-#include "ctkRuntimeException.h"
+#include "ctkException.h"
+
+#include <ctkPluginFrameworkExport.h>
 
 /**
  * \ingroup PluginFramework
@@ -71,6 +73,15 @@ public:
   };
 
   /**
+   * Creates a <code>ctkServiceException</code> with the specified message and
+   * type.
+   *
+   * @param msg The associated message.
+   * @param type The type for this exception.
+   */
+  ctkServiceException(const QString& msg, const Type& type = UNSPECIFIED);
+
+  /**
    * Creates a <code>ctkServiceException</code> with the specified message,
    * type and exception cause.
    *
@@ -78,7 +89,7 @@ public:
    * @param type The type for this exception.
    * @param cause The cause of this exception.
    */
-  ctkServiceException(const QString& msg, const Type& type = UNSPECIFIED, const std::exception* cause = 0);
+  ctkServiceException(const QString& msg, const Type& type, const ctkException& cause);
 
   /**
    * Creates a <code>ctkServiceException</code> with the specified message and
@@ -87,12 +98,22 @@ public:
    * @param msg The associated message.
    * @param cause The cause of this exception.
    */
-  ctkServiceException(const QString& msg, const std::exception* cause);
+  ctkServiceException(const QString& msg, const ctkException& cause);
 
   ctkServiceException(const ctkServiceException& o);
   ctkServiceException& operator=(const ctkServiceException& o);
 
-  ~ctkServiceException() throw() { }
+  ~ctkServiceException() throw();
+
+  /**
+   * @see ctkException::name()
+   */
+  const char* name() const throw();
+
+  /**
+   * @see ctkException::clone()
+   */
+  ctkServiceException* clone() const;
 
   /**
    * Returns the type for this exception or <code>UNSPECIFIED</code> if the
@@ -111,9 +132,4 @@ private:
 
 };
 
-/**
- * \ingroup PluginFramework
- */
-CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkServiceException& exc);
-
 #endif // CTKSERVICEEXCEPTION_H

+ 3 - 3
Libs/PluginFramework/ctkServiceReference.cpp

@@ -127,9 +127,9 @@ bool ctkServiceReference::operator<(const ctkServiceReference& reference) const
   bool sameFw = d_func()->registration->plugin->fwCtx == reference.d_func()->registration->plugin->fwCtx;
   if (!sameFw)
   {
-    throw std::invalid_argument("Can not compare service references "
-                                "belonging to different framework "
-                                "instances.");
+    throw ctkInvalidArgumentException("Can not compare service references "
+                                      "belonging to different framework "
+                                      "instances.");
   }
 
   int r1 = getProperty(ctkPluginConstants::SERVICE_RANKING).toInt();

+ 8 - 10
Libs/PluginFramework/ctkServiceReferencePrivate.cpp

@@ -67,19 +67,18 @@ QObject* ctkServiceReferencePrivate::getService(QSharedPointer<ctkPlugin> plugin
           {
             s = serviceFactory->getService(plugin, ctkServiceRegistration(registration));
           }
-          catch (const std::exception& pe)
+          catch (const ctkException& pe)
           {
             ctkServiceException se("ctkServiceFactory throw an exception",
-                                   ctkServiceException::FACTORY_EXCEPTION, &pe);
-            plugin->d_func()->fwCtx->listeners.frameworkError
-                (registration->plugin->q_func(), se);
+                                   ctkServiceException::FACTORY_EXCEPTION, pe);
+            plugin->d_func()->fwCtx->listeners.frameworkError(registration->plugin->q_func(), se);
             return 0;
           }
-          if (s == 0) {
+          if (s == 0)
+          {
             ctkServiceException se("ctkServiceFactory produced null",
                                    ctkServiceException::FACTORY_ERROR);
-            plugin->d_func()->fwCtx->listeners.frameworkError
-                (registration->plugin->q_func(), se);
+            plugin->d_func()->fwCtx->listeners.frameworkError(registration->plugin->q_func(), se);
             return 0;
           }
           for (QStringListIterator i(classes); i.hasNext(); )
@@ -90,8 +89,7 @@ QObject* ctkServiceReferencePrivate::getService(QSharedPointer<ctkPlugin> plugin
               ctkServiceException se(QString("ctkServiceFactory produced an object ") +
                                      "that did not implement: " + cls,
                                      ctkServiceException::FACTORY_ERROR);
-              plugin->d_func()->fwCtx->listeners.frameworkError
-                  (registration->plugin->q_func(), se);
+              plugin->d_func()->fwCtx->listeners.frameworkError(registration->plugin->q_func(), se);
               return 0;
             }
           }
@@ -159,7 +157,7 @@ bool ctkServiceReferencePrivate::ungetService(QSharedPointer<ctkPlugin> plugin,
         qobject_cast<ctkServiceFactory*>(
               registration->getService())->ungetService(plugin, ctkServiceRegistration(registration), sfi);
       }
-      catch (const std::exception& e)
+      catch (const ctkException& e)
       {
         plugin->d_func()->fwCtx->listeners.frameworkError(registration->plugin->q_func(), e);
       }

+ 2 - 3
Libs/PluginFramework/ctkServiceRegistration.cpp

@@ -191,11 +191,10 @@ void ctkServiceRegistration::unregister()
                                                                        *this,
                                                                        obj);
           }
-          catch (const std::exception& ue)
+          catch (const ctkException& ue)
           {
             ctkPluginFrameworkEvent pfwEvent(ctkPluginFrameworkEvent::PLUGIN_ERROR, d->plugin->q_func(), ue);
-            d->plugin->fwCtx->listeners
-                .emitFrameworkEvent(pfwEvent);
+            d->plugin->fwCtx->listeners.emitFrameworkEvent(pfwEvent);
           }
         }
       }

+ 3 - 2
Libs/PluginFramework/ctkServiceSlotEntry.cpp

@@ -24,6 +24,7 @@
 
 #include "ctkLDAPExpr_p.h"
 #include "ctkPlugin.h"
+#include "ctkException.h"
 
 #include <QSharedData>
 
@@ -123,11 +124,11 @@ void ctkServiceSlotEntry::invokeSlot(const ctkServiceEvent &event)
                                  Qt::DirectConnection,
                                  Q_ARG(ctkServiceEvent, event)))
   {
-    throw std::runtime_error(
+    throw ctkRuntimeException(
                 QString("Slot %1 of %2 could not be invoked. A call to "
                         "ctkPluginContext::connectServiceListener() must only contain "
                         "the slot name, not the whole signature.").
-                arg(d->slot).arg(d->receiver->metaObject()->className()).toStdString());
+                arg(d->slot).arg(d->receiver->metaObject()->className()));
   }
 }
 

+ 4 - 4
Libs/PluginFramework/ctkServices.cpp

@@ -90,7 +90,7 @@ ctkServiceRegistration ctkServices::registerService(ctkPluginPrivate* plugin,
 {
   if (service == 0)
   {
-    throw std::invalid_argument("Can't register 0 as a service");
+    throw ctkInvalidArgumentException("Can't register 0 as a service");
   }
 
   // Check if service implements claimed classes and that they exist.
@@ -99,7 +99,7 @@ ctkServiceRegistration ctkServices::registerService(ctkPluginPrivate* plugin,
     QString cls = i.next();
     if (cls.isEmpty())
     {
-      throw std::invalid_argument("Can't register as null class");
+      throw ctkInvalidArgumentException("Can't register as null class");
     }
 
     if (!(qobject_cast<ctkServiceFactory*>(service)))
@@ -108,7 +108,7 @@ ctkServiceRegistration ctkServices::registerService(ctkPluginPrivate* plugin,
       {
         QString msg = QString("Service class %1 is not an instance of %2. Maybe you forgot the Q_INTERFACES macro in the service class.")
             .arg(service->metaObject()->className()).arg(cls);
-        throw std::invalid_argument(msg.toStdString());
+        throw ctkInvalidArgumentException(msg);
       }
     }
   }
@@ -176,7 +176,7 @@ ctkServiceReference ctkServices::get(ctkPluginPrivate* plugin, const QString& cl
       return srs.front();
     }
   }
-  catch (const std::invalid_argument& )
+  catch (const ctkInvalidArgumentException& )
   { }
 
   return ctkServiceReference();

+ 9 - 9
Libs/PluginFramework/ctkVersion.cpp

@@ -21,7 +21,7 @@
 
 #include "ctkVersion.h"
 
-#include <stdexcept>
+#include "ctkException.h"
 
 #include <QStringListIterator>
 #include <QDebug>
@@ -66,7 +66,7 @@ ctkVersion::ctkVersion(bool undefined)
 void ctkVersion::validate()
 {
   if (!RegExp.exactMatch(qualifier))
-    throw std::invalid_argument(std::string("invalid qualifier: ") + qualifier.toStdString());
+    throw ctkInvalidArgumentException(QString("invalid qualifier: ") + qualifier);
 
   undefined = false;
 }
@@ -122,7 +122,7 @@ ctkVersion::ctkVersion(const QString& version)
     }
   }
 
-  if (!ok) throw std::invalid_argument("invalid format");
+  if (!ok) throw ctkInvalidArgumentException("invalid format");
 
   majorVersion = maj;
   minorVersion = min;
@@ -166,28 +166,28 @@ bool ctkVersion::isUndefined() const
 //----------------------------------------------------------------------------
 unsigned int ctkVersion::getMajor() const
 {
-  if (undefined) throw std::logic_error("Version undefined");
+  if (undefined) throw ctkIllegalStateException("Version undefined");
   return majorVersion;
 }
 
 //----------------------------------------------------------------------------
 unsigned int ctkVersion::getMinor() const
 {
-  if (undefined) throw std::logic_error("Version undefined");
+  if (undefined) throw ctkIllegalStateException("Version undefined");
   return minorVersion;
 }
 
 //----------------------------------------------------------------------------
 unsigned int ctkVersion::getMicro() const
 {
-  if (undefined) throw std::logic_error("Version undefined");
+  if (undefined) throw ctkIllegalStateException("Version undefined");
   return microVersion;
 }
 
 //----------------------------------------------------------------------------
 QString ctkVersion::getQualifier() const
 {
-  if (undefined) throw std::logic_error("Version undefined");
+  if (undefined) throw ctkIllegalStateException("Version undefined");
   return qualifier;
 }
 
@@ -214,7 +214,7 @@ bool ctkVersion::operator==(const ctkVersion& other) const
   }
 
   if (other.undefined && this->undefined) return true;
-  if (this->undefined) throw std::logic_error("Version undefined");
+  if (this->undefined) throw ctkIllegalStateException("Version undefined");
   if (other.undefined) return false;
 
   return (majorVersion == other.majorVersion) && (minorVersion == other.minorVersion) && (microVersion
@@ -230,7 +230,7 @@ int ctkVersion::compare(const ctkVersion& other) const
   }
 
   if (this->undefined || other.undefined)
-    throw std::logic_error("Cannot compare undefined version");
+    throw ctkIllegalStateException("Cannot compare undefined version");
 
   if (majorVersion < other.majorVersion)
   {

+ 26 - 1
Libs/PluginFramework/service/cm/ctkConfigurationException.cpp

@@ -25,8 +25,16 @@
 #include <QDebug>
 
 //----------------------------------------------------------------------------
+ctkConfigurationException::ctkConfigurationException(const QString& property, const QString& reason)
+  : ctkRuntimeException(property + " : " + reason),
+    property(property), reason(reason)
+{
+
+}
+
+//----------------------------------------------------------------------------
 ctkConfigurationException::ctkConfigurationException(const QString& property, const QString& reason,
-                          const std::exception* cause)
+                                                     const ctkException& cause)
   : ctkRuntimeException(property + " : " + reason, cause),
     property(property), reason(reason)
 {
@@ -50,6 +58,23 @@ ctkConfigurationException& ctkConfigurationException::operator=(const ctkConfigu
 }
 
 //----------------------------------------------------------------------------
+ctkConfigurationException::~ctkConfigurationException() throw()
+{
+}
+
+//----------------------------------------------------------------------------
+const char* ctkConfigurationException::name() const throw()
+{
+  return "ctkConfigurationException";
+}
+
+//----------------------------------------------------------------------------
+ctkConfigurationException* ctkConfigurationException::clone() const
+{
+  return new ctkConfigurationException(*this);
+}
+
+//----------------------------------------------------------------------------
 QString ctkConfigurationException::getProperty() const
 {
   return property;

+ 24 - 3
Libs/PluginFramework/service/cm/ctkConfigurationException.h

@@ -23,7 +23,9 @@
 #ifndef CTKCONFIGURATIONEXCEPTION_H
 #define CTKCONFIGURATIONEXCEPTION_H
 
-#include "ctkRuntimeException.h"
+#include "ctkException.h"
+
+#include <ctkPluginFrameworkEvent.h>
 
 /**
  * \ingroup ConfigAdmin
@@ -42,15 +44,34 @@ public:
    * @param property name of the property that caused the problem,
    *        <code>null</code> if no specific property was the cause
    * @param reason reason for failure
+   */
+  ctkConfigurationException(const QString& property, const QString& reason);
+
+  /**
+   * Create a <code>ctkConfigurationException</code> object.
+   *
+   * @param property name of the property that caused the problem,
+   *        <code>null</code> if no specific property was the cause
+   * @param reason reason for failure
    * @param cause The cause of this exception.
    */
   ctkConfigurationException(const QString& property, const QString& reason,
-                            const std::exception* cause = 0);
+                            const ctkException& cause);
 
   ctkConfigurationException(const ctkConfigurationException& o);
   ctkConfigurationException& operator=(const ctkConfigurationException& o);
 
-  ~ctkConfigurationException() throw() { }
+  ~ctkConfigurationException() throw();
+
+  /**
+   * @see ctkException::name()
+   */
+  const char* name() const throw();
+
+  /**
+   * @see ctkException::clone()
+   */
+  ctkConfigurationException* clone() const;
 
   /**
    * Return the property name that caused the failure or a null QString.

+ 2 - 1
Libs/PluginFramework/service/log/ctkLogEntry.h

@@ -28,7 +28,8 @@
 #include <QMetaType>
 
 #include <ctkServiceReference.h>
-#include <ctkRuntimeException.h>
+
+class ctkRuntimeException;
 
 
 /**

+ 1 - 1
Plugins/org.commontk.eventadmin/adapter/ctkEAFrameworkEventAdapter.cpp

@@ -102,7 +102,7 @@ void ctkEAFrameworkEventAdapter::frameworkEvent(const ctkPluginFrameworkEvent& e
   {
     getEventAdmin()->postEvent(ctkEvent(topic, properties));
   }
-  catch(const std::logic_error& )
+  catch(const ctkIllegalStateException& )
   {
     // This is o.k. - indicates that we are stopped.
   }

+ 1 - 1
Plugins/org.commontk.eventadmin/adapter/ctkEAPluginEventAdapter.cpp

@@ -86,7 +86,7 @@ void ctkEAPluginEventAdapter::pluginChanged(const ctkPluginEvent& event)
   {
     getEventAdmin()->postEvent(ctkEvent(topic, properties));
   }
-  catch (const std::logic_error& )
+  catch (const ctkIllegalStateException& )
   {
     // This is o.k. - indicates that we are stopped.
   }

+ 1 - 1
Plugins/org.commontk.eventadmin/adapter/ctkEAServiceEventAdapter.cpp

@@ -90,7 +90,7 @@ void ctkEAServiceEventAdapter::serviceChanged(const ctkServiceEvent& event)
   {
     getEventAdmin()->postEvent(ctkEvent(topic, properties));
   }
-  catch(const std::logic_error& )
+  catch(const ctkIllegalStateException& )
   {
     // This is o.k. - indicates that we are stopped.
   }

+ 14 - 0
Plugins/org.commontk.eventadmin/dispatch/ctkEAInterruptedException.cpp

@@ -27,3 +27,17 @@ ctkEAInterruptedException::ctkEAInterruptedException()
 {
 
 }
+
+ctkEAInterruptedException::~ctkEAInterruptedException() throw()
+{
+}
+
+const char *ctkEAInterruptedException::name() const throw()
+{
+  return "ctkEAInterruptedException";
+}
+
+ctkEAInterruptedException *ctkEAInterruptedException::clone() const
+{
+  return new ctkEAInterruptedException(*this);
+}

+ 7 - 1
Plugins/org.commontk.eventadmin/dispatch/ctkEAInterruptedException_p.h

@@ -23,7 +23,7 @@
 #ifndef CTKEAINTERRUPTEDEXCEPTION_P_H
 #define CTKEAINTERRUPTEDEXCEPTION_P_H
 
-#include <ctkRuntimeException.h>
+#include <ctkException.h>
 
 /**
  * Thrown when a ctkEAInterruptibleThread is waiting, sleeping, or otherwise occupied,
@@ -40,6 +40,12 @@ class ctkEAInterruptedException : public ctkRuntimeException
 {
 public:
   ctkEAInterruptedException();
+
+  ~ctkEAInterruptedException() throw();
+
+  const char* name() const throw();
+
+  ctkEAInterruptedException* clone() const;
 };
 
 #endif // CTKEAINTERRUPTEDEXCEPTION_P_H

+ 2 - 2
Plugins/org.commontk.eventadmin/dispatch/ctkEALinkedQueue.cpp

@@ -44,7 +44,7 @@ ctkEALinkedQueue::~ctkEALinkedQueue()
 
 void ctkEALinkedQueue::put(ctkEARunnable* x)
 {
-  if (x == 0) throw std::invalid_argument("QRunnable cannot be null");
+  if (x == 0) throw ctkInvalidArgumentException("QRunnable cannot be null");
   if (ctkEAInterruptibleThread::interrupted()) throw ctkEAInterruptedException();
   insert(x);
 }
@@ -53,7 +53,7 @@ bool ctkEALinkedQueue::offer(ctkEARunnable* x, long msecs)
 {
   Q_UNUSED(msecs)
 
-  if (x == 0) throw std::invalid_argument("QRunnable cannot be null");
+  if (x == 0) throw ctkInvalidArgumentException("QRunnable cannot be null");
   if (ctkEAInterruptibleThread::interrupted()) throw ctkEAInterruptedException();
   insert(x);
   return true;

+ 14 - 0
Plugins/org.commontk.eventadmin/util/ctkEABrokenBarrierException.cpp

@@ -27,3 +27,17 @@ ctkEABrokenBarrierException::ctkEABrokenBarrierException(int idx, const QString&
 {
 
 }
+
+ctkEABrokenBarrierException::~ctkEABrokenBarrierException() throw()
+{
+}
+
+const char *ctkEABrokenBarrierException::name() const throw()
+{
+  return "ctkEABrokenBarrierException";
+}
+
+ctkEABrokenBarrierException *ctkEABrokenBarrierException::clone() const
+{
+  return new ctkEABrokenBarrierException(*this);
+}

+ 13 - 1
Plugins/org.commontk.eventadmin/util/ctkEABrokenBarrierException_p.h

@@ -23,7 +23,7 @@
 #ifndef CTKEABROKENBARRIEREXCEPTION_P_H
 #define CTKEABROKENBARRIEREXCEPTION_P_H
 
-#include <ctkRuntimeException.h>
+#include <ctkException.h>
 
 /**
  * Thrown by barrier classes upon interruption of participant threads
@@ -44,6 +44,18 @@ public:
    * specified index and detail message.
    */
   ctkEABrokenBarrierException(int idx, const QString& message = QString());
+
+  ~ctkEABrokenBarrierException() throw();
+
+  /**
+   * @see ctkException::name()
+   */
+  const char* name() const throw();
+
+  /**
+   * @see ctkException::clone()
+   */
+  ctkEABrokenBarrierException* clone() const;
 };
 
 #endif // CTKEABROKENBARRIEREXCEPTION_P_H

+ 1 - 1
Plugins/org.commontk.eventadmin/util/ctkEACyclicBarrier.cpp

@@ -39,7 +39,7 @@ ctkEACyclicBarrier::ctkEACyclicBarrier(int parties, ctkEARunnable* command)
   : parties_(parties), broken_(false), barrierCommand_(command),
     count_(parties), resets_(0)
 {
-  if (parties <= 0) throw new std::invalid_argument("parties cannot be negative");
+  if (parties <= 0) throw ctkInvalidArgumentException("parties cannot be negative");
   if (barrierCommand_) ++barrierCommand_->ref;
 }
 

+ 14 - 0
Plugins/org.commontk.eventadmin/util/ctkEATimeoutException.cpp

@@ -27,3 +27,17 @@ ctkEATimeoutException::ctkEATimeoutException(long time, const QString& message)
 {
 
 }
+
+ctkEATimeoutException::~ctkEATimeoutException() throw()
+{
+}
+
+const char *ctkEATimeoutException::name() const throw()
+{
+  return "ctkEATimeoutException";
+}
+
+ctkEATimeoutException *ctkEATimeoutException::clone() const
+{
+  return new ctkEATimeoutException(*this);
+}

+ 12 - 1
Plugins/org.commontk.eventadmin/util/ctkEATimeoutException_p.h

@@ -23,7 +23,7 @@
 #ifndef CTKEATIMEOUTEXCEPTION_P_H
 #define CTKEATIMEOUTEXCEPTION_P_H
 
-#include <ctkRuntimeException.h>
+#include <ctkException.h>
 
 /**
  * Thrown by synchronization classes that report
@@ -46,6 +46,17 @@ public:
    */
   ctkEATimeoutException(long time, const QString& message = QString());
 
+  ~ctkEATimeoutException() throw();
+
+  /**
+   * @see ctkException::name()
+   */
+  const char* name() const throw();
+
+  /**
+   * @see ctkException::clone()
+   */
+  ctkEATimeoutException* clone() const;
 };
 
 #endif // CTKEATIMEOUTEXCEPTION_P_H