You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/10/06 10:09:12 UTC

svn commit: r701985 - in /felix/trunk/ipojo: composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ core/src/main/java/org/apache/felix/ipojo/ core/src/m...

Author: clement
Date: Mon Oct  6 01:09:11 2008
New Revision: 701985

URL: http://svn.apache.org/viewvc?rev=701985&view=rev
Log:
Fixes several cosmetic bugs (error messages).
Adds a mechanism avoiding double injection of properties.

Modified:
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java (original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java Mon Oct  6 01:09:11 2008
@@ -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");

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java (original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java Mon Oct  6 01:09:11 2008
@@ -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();
         }
 

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java (original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java Mon Oct  6 01:09:11 2008
@@ -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

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/Extender.java Mon Oct  6 01:09:11 2008
@@ -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);
                 }
             }
         }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java Mon Oct  6 01:09:11 2008
@@ -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());
             }
         }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java Mon Oct  6 01:09:11 2008
@@ -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;

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java Mon Oct  6 01:09:11 2008
@@ -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");
     }
 
     /**

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java Mon Oct  6 01:09:11 2008
@@ -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
             }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java Mon Oct  6 01:09:11 2008
@@ -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();
         }
 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java Mon Oct  6 01:09:11 2008
@@ -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");

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java Mon Oct  6 01:09:11 2008
@@ -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);
                 }
             }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java Mon Oct  6 01:09:11 2008
@@ -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")) {

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java Mon Oct  6 01:09:11 2008
@@ -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());
             }
         }
     }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java Mon Oct  6 01:09:11 2008
@@ -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));

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java Mon Oct  6 01:09:11 2008
@@ -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) {

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java Mon Oct  6 01:09:11 2008
@@ -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");

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java?rev=701985&r1=701984&r2=701985&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java Mon Oct  6 01:09:11 2008
@@ -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);
         }
     }