Fixes several cosmetic bugs (error messages).
Adds a mechanism avoiding double injection of properties.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@701985 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
index 76f912c..c33fda1 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
@@ -139,8 +139,8 @@
 

         if (specification == null) { 

             // Malformed import

-            error("Malformed imports : the specification attribute is mandatory");

-            throw new ConfigurationException("Malformed imports : the specification attribute is mandatory");

+            error("Malformed import: the specification attribute is mandatory");

+            throw new ConfigurationException("Malformed import : the specification attribute is mandatory");

         } else {

             String opt = imp.getAttribute("optional");

             optional = opt != null && opt.equalsIgnoreCase("true");

diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
index 93de3d0..7fab7f2 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
@@ -246,13 +246,13 @@
             }

             

         } catch (UnacceptableConfiguration e) {

-            m_handler.error("A matching factory refuse the actual configuration : " + e.getMessage());

+            m_handler.error("A matching factory refuses the actual configuration : " + e.getMessage());

             m_handler.getCompositeManager().stop();

         } catch (MissingHandlerException e) {

             m_handler.error("A matching factory is no more valid : " + e.getMessage());

             m_handler.getCompositeManager().stop();

         } catch (ConfigurationException e) {

-            m_handler.error("A matching configuration is refuse by the instance : " + e.getMessage());

+            m_handler.error("A matching configuration is refused by the instance : " + e.getMessage());

             m_handler.getCompositeManager().stop();

         }

 

diff --git a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
index 50f2ffb..017919e 100644
--- a/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
+++ b/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
@@ -336,8 +336,8 @@
                     checkRequirement(imp, reqs[j]);

                 }

             } else {

-                error("[" + getCompositeManager().getInstanceName() + "] The specification field of the service specification " + svc.getSpecification() + " need to be a String");

-                throw new CompositionException("Service Specification checking failed : The specification field of the service specification " + svc.getSpecification() + " need to be a String");

+                error("[" + getCompositeManager().getInstanceName() + "] The specification field of the service specification " + svc.getSpecification() + " needs to be a String");

+                throw new CompositionException("Service Specification checking failed : The specification field of the service specification " + svc.getSpecification() + " needs to be a String");

             }

         } catch (NoSuchFieldException e) {

             return; // No specification field

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
index cc1b667..44b51b1 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
@@ -622,7 +622,7 @@
                     startManagementFor(bundle);

                 } catch (Throwable e) {

                     // To be sure to not kill the thread, we catch all exceptions and errors

-                    m_logger.log(Logger.ERROR, "An errors occurs when analyzing the content or starting the management of " + bundle.getBundleId());

+                    m_logger.log(Logger.ERROR, "An error occurs when analyzing the content or starting the management of " + bundle.getBundleId(), e);

                 }

             }

         }

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
index c1d725b..31544bd 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
@@ -604,7 +604,7 @@
                 m_logger.log(Logger.ERROR, "The configuration is not acceptable : " + e.getMessage());

                 throw new org.osgi.service.cm.ConfigurationException(properties.toString(), e.getMessage());

             } catch (MissingHandlerException e) {

-                m_logger.log(Logger.ERROR, "The facotry is not valid, at least one handler is missing : " + e.getMessage());

+                m_logger.log(Logger.ERROR, "The factory is not valid, at least one handler is missing : " + e.getMessage());

                 throw new org.osgi.service.cm.ConfigurationException(properties.toString(), e.getMessage());

             }

         }

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
index aa074ed..8a47d4a 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
@@ -605,7 +605,7 @@
                                           Logger.ERROR,
                                           "["
                                                   + m_name
-                                                  + "] createInstance -> The Component Instance is not accessible (security reason) : "
+                                                  + "] createInstance -> The POJO constructor is not accessible (security reason) : "
                                                   + e.getMessage());
                 stop();
                 return null;
@@ -1014,7 +1014,7 @@
                 return null;
             }
             // Cannot happen
-            m_factory.getLogger().log(Logger.ERROR, "A methodID cannot be associate with a POJO method : " + methodId);
+            m_factory.getLogger().log(Logger.ERROR, "A methodID cannot be associated with a method from the POJO class: " + methodId);
             return null;
         } else {
             return method;
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java
index 5a57c83..b5da627 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java
@@ -101,7 +101,7 @@
      * @see org.osgi.framework.ServiceReference#getUsingBundles()

      */

     public Bundle[] getUsingBundles() {

-        throw new UnsupportedOperationException("getUsingBundles is not supported in scope");

+        throw new UnsupportedOperationException("getUsingBundles is not supported in service context");

     }

 

     /**

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
index 47b9424..9a6378d 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
@@ -108,7 +108,7 @@
             String methodName = configurables[i].getAttribute("method");
             
             if (fieldName == null && methodName == null) {
-                throw new ConfigurationException("Malformed property : The property need to contain at least a field or a method");
+                throw new ConfigurationException("Malformed property : The property needs to contain at least a field or a method");
             }
 
             String name = configurables[i].getAttribute("name");
@@ -131,21 +131,21 @@
                 if (method.length == 0) {
                     type = configurables[i].getAttribute("type");
                     if (type == null) {
-                        throw new ConfigurationException("Malformed property : The type of the property cannot be discovered, please add a 'type' attribute");
+                        throw new ConfigurationException("Malformed property : The type of the property cannot be discovered, add a 'type' attribute");
                     }
                 } else {
                     if (method[0].getMethodArguments().length != 1) {
                         throw new ConfigurationException("Malformed property :  The method " + methodName + " does not have one argument");
                     }
                     if (type != null && !type.equals(method[0].getMethodArguments()[0])) {
-                        throw new ConfigurationException("Malformed property :   The field type (" + type + ") and the method type (" + method[0].getMethodArguments()[0] + ") are not the same.");
+                        throw new ConfigurationException("Malformed property :   The field type (" + type + ") and the type of the argument of the setter method (" + method[0].getMethodArguments()[0] + ") are not the same.");
                     }
                     type = method[0].getMethodArguments()[0];
                     configurables[i].addAttribute(new Attribute("type", type)); // Add the type to avoid configure checking
                 }
             } else {
                 FieldMetadata field = manipulation.getField(fieldName);
-                if (field == null) { throw new ConfigurationException("Malformed property : The field " + fieldName + " does not exist in the implementation"); }
+                if (field == null) { throw new ConfigurationException("Malformed property : The field " + fieldName + " does not exist in the implementation class"); }
                 type = field.getFieldType();
                 configurables[i].addAttribute(new Attribute("type", type)); // Add the type to avoid configure checking
             }
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
index 429f141..63e826d 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
@@ -274,13 +274,13 @@
                 callback.callOnInstance(pojo, ref, getService(ref));
             }
         } catch (NoSuchMethodException e) {
-            m_handler.error("The method " + callback.getMethodName() + " does not exist in the class " + m_handler.getInstanceManager().getClassName());
+            m_handler.error("The method " + callback.getMethodName() + " does not exist in the implementation class " + m_handler.getInstanceManager().getClassName());
             m_handler.getInstanceManager().stop();
         } catch (IllegalAccessException e) {
-            m_handler.error("The method " + callback.getMethodName() + " is not accessible in the class " + m_handler.getInstanceManager().getClassName());
+            m_handler.error("The method " + callback.getMethodName() + " is not accessible in the implementation class " + m_handler.getInstanceManager().getClassName());
             m_handler.getInstanceManager().stop();
         } catch (InvocationTargetException e) {
-            m_handler.error("The method " + callback.getMethodName() + " in the class " + m_handler.getInstanceManager().getClassName() + " throws an exception : " + e.getTargetException().getMessage(), e.getTargetException());
+            m_handler.error("The method " + callback.getMethodName() + " in the implementation class " + m_handler.getInstanceManager().getClassName() + " throws an exception : " + e.getTargetException().getMessage(), e.getTargetException());
             m_handler.getInstanceManager().stop();
         }
 
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
index 61cbc6a..b65e455 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
@@ -174,18 +174,18 @@
         DependencyCallback[] callbacks = dep.getCallbacks();
 
         if (callbacks == null && field == null) {
-            throw new ConfigurationException("A service requirement requires at least callbacks or a field");
+            throw new ConfigurationException("A service requirement requires at least binding methods or a field");
         }
 
         for (int i = 0; callbacks != null && i < callbacks.length; i++) {
             MethodMetadata[] mets = manipulation.getMethods(callbacks[i].getMethodName());
             if (mets.length == 0) {
-                info("A requirement callback " + callbacks[i].getMethodName() + " does not exist in the implementation, try the super classes");
+                info("A requirement callback " + callbacks[i].getMethodName() + " does not exist in the implementation class, will try the super classes");
             } else {
                 if (mets[0].getMethodArguments().length > 2) {
                     throw new ConfigurationException("Requirement Callback : A requirement callback "
                             + callbacks[i].getMethodName()
-                            + " must have 0 or 1 or 2 arguments");
+                            + " must have 0, 1 or 2 arguments");
                 }
 
                 callbacks[i].setArgument(mets[0].getMethodArguments());
@@ -272,11 +272,11 @@
                             + "] are not the same");
                     } else {
                         // If the specification is different, warn that we will override it.
-                        warn("[DependencyHandler on "
+                        warn("["
                             + getInstanceManager().getInstanceName()
                             + "] The field type ["
                             + className
-                            + "] and the needed service interface ["
+                            + "] and the required service interface ["
                             + dep.getSpecification()
                             + "] are not the same");
                     }
@@ -367,7 +367,7 @@
             if (from != null) {
                 String fromFilter = "(|(instance.name=" + from + ")(service.pid=" + from + "))";
                 if (aggregate) {
-                    warn("The 'from' attribute is incompatible with aggregate requirement : only one provider will match : " + fromFilter);
+                    warn("The 'from' attribute is incompatible with aggregate requirements: only one provider will match : " + fromFilter);
                 }
                 if (filter != null) {
                     filter = "(&" + fromFilter + filter + ")"; // Append the two filters
@@ -399,7 +399,7 @@
             Element[] cbs = deps[i].getElements("Callback");
             for (int j = 0; cbs != null && j < cbs.length; j++) {
                 if (!cbs[j].containsAttribute("method") && cbs[j].containsAttribute("type")) {
-                    throw new ConfigurationException("Requirement Callback : a dependency callback must contain a method and a type attribute");
+                    throw new ConfigurationException("Requirement Callback : a dependency callback must contain a method and a type (bind or unbind) attribute");
                 }
                 String method = cbs[j].getAttribute("method");
                 String type = cbs[j].getAttribute("type");
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
index 85ca69a..ae80448 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
@@ -62,7 +62,7 @@
             }
         }
 
-        if (m_callbacks.length > 0) {
+        if (m_callbacks != null && m_callbacks.length > 0) { //TODO check here if we can improve the test
             LifecycleCallback[] newHk = new LifecycleCallback[m_callbacks.length + 1];
             System.arraycopy(m_callbacks, 0, newHk, 0, m_callbacks.length);
             newHk[m_callbacks.length] = callback;
@@ -70,7 +70,6 @@
         } else {
             m_callbacks = new LifecycleCallback[] { callback };
         }
-
     }
 
     /**
@@ -92,7 +91,7 @@
         for (int i = 0; hooksMetadata != null && i < hooksMetadata.length; i++) {
             String method = hooksMetadata[i].getAttribute("method");
             if (method == null) {
-                throw new ConfigurationException("Lifecycle callback : A callback needs to contains a method attribute");
+                throw new ConfigurationException("Lifecycle callback : A callback needs to contain a method attribute");
             }
             
             MethodMetadata met = meta.getMethod(method, new String[0]);
@@ -168,7 +167,7 @@
                     error("[" + getInstanceManager().getInstanceName() + "] The callback method " + m_callbacks[i].getMethod() + " is not accessible");
                     throw new IllegalStateException(e.getMessage());
                 } catch (InvocationTargetException e) {
-                    error("[" + getInstanceManager().getInstanceName() + "] The callback method " + m_callbacks[i].getMethod() + " has throws an exception : " + e.getTargetException().getMessage(), e.getTargetException());
+                    error("[" + getInstanceManager().getInstanceName() + "] The callback method " + m_callbacks[i].getMethod() + " has thrown an exception : " + e.getTargetException().getMessage(), e.getTargetException());
                     getInstanceManager().setState(ComponentInstance.INVALID);
                 }
             }
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java
index 6d00b3b..d76670d 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java
@@ -123,13 +123,13 @@
         // Use only the first controller

         field = controller[0].getAttribute("field");

         if (field == null) {

-            throw new ConfigurationException("Lifecycle controller : the controller element needs to have a field attribute");

+            throw new ConfigurationException("Lifecycle controller : the controller element needs to contain a field attribute");

         }

         

         PojoMetadata method = getFactory().getPojoMetadata();

         FieldMetadata fieldMetadata = method.getField(field);

         if (fieldMetadata == null) {

-            throw new ConfigurationException("Lifecycle controller : The field " + field + " does not exist in the class");

+            throw new ConfigurationException("Lifecycle controller : The field " + field + " does not exist in the implementation class");

         }

         

         if (!fieldMetadata.getFieldType().equalsIgnoreCase("boolean")) {

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
index 4f1d52c..e9b8b5b 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
@@ -313,7 +313,7 @@
                 prop = new Property(key, null, null, value.toString(), value.getClass().getName(), getInstanceManager(), m_handler);
                 addProperty(prop);
             } catch (ConfigurationException e) {
-                m_handler.error("The propagated property " + key + " cannot be pcreated correctly : " + e.getMessage());
+                m_handler.error("The propagated property " + key + " cannot be created correctly : " + e.getMessage());
             }
         }
     }
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
index 4bbdec6..3535dc0 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
@@ -68,7 +68,7 @@
             if (m_providedServices[i] == svc) { return; }
         }
 
-        if (m_providedServices.length > 0) {
+        if (m_providedServices != null && m_providedServices.length > 0) { //TODO check here if we can avoid one test
             ProvidedService[] newPS = new ProvidedService[m_providedServices.length + 1];
             System.arraycopy(m_providedServices, 0, newPS, 0, m_providedServices.length);
             newPS[m_providedServices.length] = svc;
@@ -150,7 +150,7 @@
                     itfs.append(' ');
                     itfs.append(serviceSpecifications[j]);
                 }
-                throw new ConfigurationException("[" + getInstanceManager().getInstanceName() + "] The provided service" + itfs + " is not valid");                
+                throw new ConfigurationException("The provided service" + itfs + " is not valid");                
             }
 
         }
@@ -246,18 +246,18 @@
                         isDependencyCorrect(dep, deps[j]);
                     }
                 } else {
-                    throw new ConfigurationException("Provides  : The specification field of the service specification " + svc.getServiceSpecification()[i] + " need to be a String");
+                    throw new ConfigurationException("Service Providing: The specification field of the service specification " + svc.getServiceSpecification()[i] + " needs to be a String");
                 }
             } catch (NoSuchFieldException e) {
                 return true; // No specification field
             } catch (ClassNotFoundException e) {
-                throw new ConfigurationException("Provides  : The service specification " + svc.getServiceSpecification()[i] + " cannot be load");
+                throw new ConfigurationException("Service Providing: The service specification " + svc.getServiceSpecification()[i] + " cannot be load");
             } catch (IllegalArgumentException e) {
-                throw new ConfigurationException("Provides  : The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " is not accessible : " + e.getMessage());
+                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " is not accessible : " + e.getMessage());
             } catch (IllegalAccessException e) {
-                throw new ConfigurationException("Provides  : The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " is not accessible : " + e.getMessage());
+                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " is not accessible : " + e.getMessage());
             } catch (ParseException e) {
-                throw new ConfigurationException("Provides  :  The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " does not contain a valid String : " + e.getMessage());
+                throw new ConfigurationException("Service Providing: The field 'specification' of the service specification " + svc.getServiceSpecification()[i] + " does not contain a valid String : " + e.getMessage());
             }
         }
 
@@ -303,18 +303,18 @@
         boolean agg = aggregate != null && aggregate.equalsIgnoreCase("true");
 
         if (dep == null && !opt) {
-            throw new ConfigurationException("Provides  :  The requirement " + elem.getAttribute("specification") + " is not present in the implementation and is declared as a mandatory service-level requirement");
+            throw new ConfigurationException("Service Providing: The requirement " + elem.getAttribute("specification") + " is not present in the implementation and is declared as a mandatory service-level requirement");
         }
 
         if (dep != null && dep.isAggregate() && !agg) {
-            throw new ConfigurationException("Provides  :  The requirement " + elem.getAttribute("specification") + " is aggregate in the implementation and is declared as a simple service-level requirement");
+            throw new ConfigurationException("Service Providing: The requirement " + elem.getAttribute("specification") + " is aggregate in the implementation and is declared as a simple service-level requirement");
         }
 
         String filter = elem.getAttribute("filter");
         if (dep != null && filter != null) {
             String filter2 = dep.getFilter();
             if (filter2 == null || !filter2.equalsIgnoreCase(filter)) {
-                throw new ConfigurationException("Provides  :  The specification requirement " + elem.getAttribute("specification") + " as not the same filter as declared in the service-level requirement");
+                throw new ConfigurationException("Service Providing: The specification requirement " + elem.getAttribute("specification") + " has not the same filter as declared in the service-level requirement");
             }
         }
     }
@@ -521,7 +521,7 @@
             }
             
             if (all.isEmpty()) {
-                throw new ConfigurationException("Provides  : Cannot instantiate a provided service : no specifications found (no interfaces implemented by the pojo)");
+                throw new ConfigurationException("Service Providing: Cannot instantiate a provided service : no specifications found (no interfaces implemented by the pojo)");
             }
 
             StringBuffer specs = null;
@@ -561,7 +561,7 @@
                     }
                     FieldMetadata fieldMeta = manipulation.getField(field);
                     if (fieldMeta == null) {
-                        throw new ConfigurationException("A declared property was not found in the class : " + field);
+                        throw new ConfigurationException("A declared property was not found in the implementation class : " + field);
                     }
                     type = fieldMeta.getFieldType();
                     props[j].addAttribute(new Attribute("type", type));
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
index abac730..643eaf6 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
@@ -277,7 +277,7 @@
         String name = prop.getAttribute("name");
         String value = prop.getAttribute("value");
         if (name != null) {
-            throw new ParseException("Anonymous property expected in a list or in an array");
+            throw new ParseException("Anonymous property expected in a list or an array");
         }
         //case : the property element has no 'value' attribute
         if (value == null) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
index 3030605..553b5fc 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
@@ -62,7 +62,7 @@
     public PojoMetadata(Element metadata) throws ConfigurationException {
         Element[] elems = metadata.getElements("manipulation", "");
         if (elems == null) {
-            throw new ConfigurationException("The component " + metadata/*.getAttribute("classname")*/ + " has no manipulation metadata"); 
+            throw new ConfigurationException("The component " + metadata.getAttribute("classname") + " has no manipulation metadata"); 
         }
         Element manip = elems[0];
         m_super = manip.getAttribute("super");
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
index 81a4111..7a58004 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
@@ -59,6 +59,12 @@
      * The value of the property.

      */

     private Object m_value;

+    

+    /**

+     * Flag tracking is the method was 

+     * already called for the current value.

+     */

+    private boolean m_invoked;

 

     /**

      * The type of the property.

@@ -156,7 +162,7 @@
                 } catch (SecurityException e) {

                     throw new ConfigurationException("Security excption in setValue on " + type + " : " + e.getMessage());

                 } catch (IllegalArgumentException e) {

-                    throw new ConfigurationException("Argument problem to call the constructor of the type " + type);

+                    throw new ConfigurationException("Argument issue when calling the constructor of the type " + type);

                 }

             }

         }

@@ -207,9 +213,9 @@
         } catch (ClassNotFoundException e) {

             throw new ConfigurationException("Class not found exception in setValue on " + internalType);

         } catch (SecurityException e) {

-            throw new ConfigurationException("Secutiry Exception in setValue on " + internalType);

+            throw new ConfigurationException("Security Exception in setValue on " + internalType);

         } catch (IllegalArgumentException e) {

-            throw new ConfigurationException("Argument problem to call the constructor of the type " + internalType);

+            throw new ConfigurationException("Argument issue when calling the constructor of the type " + internalType);

         }

     }

 

@@ -271,9 +277,10 @@
                 } else {

                     // Error, the given property cannot be injected.

                     throw new ClassCastException("Incompatible type for the property " + m_name + " " + m_type.getName() + " expected, " 

-                                                 + value.getClass() + " received");

+                                                 + value.getClass() + " found");

                 }

             }

+            m_invoked = false;

         }

     }

 

@@ -330,17 +337,17 @@
             Constructor cst = type.getConstructor(new Class[] { String.class });

             return cst.newInstance(new Object[] { strValue });

         } catch (SecurityException e) {

-            throw new ConfigurationException("Security exception in create on " + type + " : " + e.getMessage());

+            throw new ConfigurationException("Security exception during the creation of " + type + " : " + e.getMessage());

         } catch (NoSuchMethodException e) {

-            throw new ConfigurationException("Constructor not found exception in create on " + type + " : " + e.getMessage());

+            throw new ConfigurationException("Constructor not found exception during the creation of " + type + " : " + e.getMessage());

         } catch (IllegalArgumentException e) {

-            throw new ConfigurationException("Argument problem to call the constructor of the type " + type);

+            throw new ConfigurationException("Argument issue when calling the constructor of the type " + type);

         } catch (InstantiationException e) {

             throw new ConfigurationException("Instantiation problem  " + type);

         } catch (IllegalAccessException e) {

             throw new ConfigurationException("Illegal Access " + type);

         } catch (InvocationTargetException e) {

-            throw new ConfigurationException("Invocation problem " + type + " : " + e.getTargetException().getMessage());

+            throw new ConfigurationException("Invocation problem during the creation of " + type + " : " + e.getTargetException().getMessage());

         }

 

     }

@@ -423,7 +430,7 @@
         } catch (NoSuchMethodException e) {

             throw new ConfigurationException("Constructor not found exception in setValue on " + interntype.getName());

         } catch (IllegalArgumentException e) {

-            throw new ConfigurationException("Argument problem to call the constructor of the type " + interntype.getName());

+            throw new ConfigurationException("Argument issue when calling the constructor of the type " + interntype.getName());

         } catch (InstantiationException e) {

             throw new ConfigurationException("Instantiation problem  " + interntype.getName());

         } catch (IllegalAccessException e) {

@@ -440,20 +447,26 @@
      * @see org.apache.felix.ipojo.Handler#onCreation(java.lang.Object)

      */

     public synchronized void invoke(Object instance) {

+        if (m_invoked) {

+            return; // Already called.

+        }

+        

         try {

             if (instance == null) {

                 m_method.call(new Object[] { m_value });

+                m_invoked = true;

             } else {

                 m_method.call(instance, new Object[] { m_value });

+                m_invoked = true;

             }

         } catch (NoSuchMethodException e) {

-            m_handler.error("The method " + m_method + " does not exist in the class " + m_manager.getClassName());

+            m_handler.error("The method " + m_method + " does not exist in the implementation class " + m_manager.getClassName());

             m_manager.stop();

         } catch (IllegalAccessException e) {

-            m_handler.error("The method " + m_method + " is not accessible in the class " + m_manager.getClassName());

+            m_handler.error("The method " + m_method + " is not accessible in the implementation class " + m_manager.getClassName());

             m_manager.stop();

         } catch (InvocationTargetException e) {

-            m_handler.error("The method " + m_method + " in the class " + m_manager.getClassName() + "throws an exception : " + e.getTargetException().getMessage(), e.getTargetException());

+            m_handler.error("The method " + m_method + " in the implementation class " + m_manager.getClassName() + "throws an exception : " + e.getTargetException().getMessage(), e.getTargetException());

             m_manager.setState(ComponentInstance.INVALID);

         }

     }