Index: trunk/src/PacpusLib/ComponentManager.cpp
===================================================================
--- trunk/src/PacpusLib/ComponentManager.cpp	(revision 199)
+++ trunk/src/PacpusLib/ComponentManager.cpp	(revision 201)
@@ -13,4 +13,5 @@
 #include <Pacpus/kernel/InputOutputBase.h>
 #include <Pacpus/kernel/Log.h>
+#include <Pacpus/kernel/PacpusException.h>
 
 #include <QDomNodeList>
@@ -290,13 +291,20 @@
         if (NULL == component) {
             LOG_WARN("component '" << componentName << "' does not exist");
-        } else {
-            component->param.localCopy(cfg.qDomElement());
+            continue;
+        }
+
+        component->param.localCopy(cfg.qDomElement());
+        try {
             component->parseParameters(cfg);
             component->setConfigurationState(component->configureComponent(cfg));
+        } catch (PacpusException & e) {
+            LOG_ERROR("component '" << componentName << "' has thrown an exception");
+            LOG_ERROR(e.what());
+            component->setConfigurationState(ComponentBase::CONFIGURED_FAILED);
         }
     } // for
 
     // Third, if some components requested a delayed configuration, retry
-    for (int i = 0; i < componentsNodeList.size(); ++i) {
+    for (int i = 0, iend = componentsNodeList.size(); i < iend; ++i) {
         cfg.localCopy(componentsNodeList.item(i).toElement());
         QString componentName = cfg.getComponentName();
@@ -305,26 +313,27 @@
         if (NULL == component) {
             LOG_WARN("component '" << componentName << "' does not exist");
+            continue;
+        }
+         
+        // Pacpus 2.0 : add inputs and outputs
+        component->addInputs();
+        component->addOutputs();
+
+        if (ComponentBase::CONFIGURATION_DELAYED == component->configurationState()) {
+            LOG_DEBUG("try to configure component '" << componentName << "'");
+
+            // copy locally the config parameters of the component
+            component->param.localCopy(cfg.qDomElement());
+            component->setConfigurationState(component->configureComponent(cfg));
+        }
+
+        if (ComponentBase::CONFIGURED_OK == component->configurationState()) {
+            --componentsToConfigureCount;
         } else {
-           // Pacpus 2.0 : add inputs and outputs
-            component->addInputs();
-            component->addOutputs();
-
-            if (ComponentBase::CONFIGURATION_DELAYED == component->configurationState()) {
-                LOG_DEBUG("try to configure component '" << componentName << "'");
-
-                // copy locally the config parameters of the component
-                component->param.localCopy(cfg.qDomElement());
-                component->setConfigurationState(component->configureComponent(cfg));
-            }
-
-            if (ComponentBase::CONFIGURED_OK == component->configurationState()) {
-                --componentsToConfigureCount;
-            } else {
-                LOG_ERROR("cannot configure component '" << componentName << "'"
-                          << ". Dependencies with other components are too complex"
-                          << ". It was not configured, please review your configuration and/or your component"
-                          );
-                component->setConfigurationState(ComponentBase::CONFIGURED_FAILED);
-            }
+            LOG_ERROR("cannot configure component '" << componentName << "'"
+                        << ". Dependencies with other components are too complex"
+                        << ". It was not configured, please review your configuration and/or your component"
+                        );
+            component->setConfigurationState(ComponentBase::CONFIGURED_FAILED);
         }
     } // for
@@ -338,5 +347,5 @@
     QDomNodeList connectionsNodeList = xmlTree_->getAllConnections();
 
-    for (int i = 0; i < connectionsNodeList.size(); ++i) {
+    for (int i = 0, iend = connectionsNodeList.size(); i < iend; ++i) {
         cfg.localCopy(connectionsNodeList.item(i).toElement());
         QString connectionInput = cfg.getConnectionInput();
@@ -372,5 +381,5 @@
 }
 
-bool ComponentManager::start(const QString& componentName)
+bool ComponentManager::start(const QString & componentName)
 {
     LOG_TRACE("start(component=" << componentName << ")");
@@ -382,4 +391,9 @@
     }
 
+    if (ComponentBase::CONFIGURED_OK != component->configurationState()) {
+        LOG_WARN("cannot start component '" << componentName << "'.  It has not been configured properly!");
+        return false;
+    }
+
     LOG_INFO("starting component '" << componentName << "'...");
     if (!component->startComponent()) {
@@ -402,5 +416,5 @@
 }
 
-bool ComponentManager::stop(ComponentBase* component) const
+bool ComponentManager::stop(ComponentBase * component) const
 {
     if (!component) {
@@ -414,5 +428,5 @@
 }
 
-bool ComponentManager::stop(const QString& componentName)
+bool ComponentManager::stop(const QString & componentName)
 {
     LOG_TRACE("stop(component=" << componentName << ")");
@@ -432,5 +446,5 @@
 }
 
-ComponentBase* ComponentManager::getComponent(const QString& name)
+ComponentBase * ComponentManager::getComponent(const QString & name)
 {
     LOG_TRACE("getComponent(name=" << name << ")");
