FELIX-1447 Remove ComponentMetadata parameter from AbstractComponentManager.log
method signature because the component metadata is directly available and
does not need to be provided by a parameter.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@800499 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
index 99f3596..1f5c123 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
@@ -137,7 +137,7 @@
                 // log and return null
                 getComponentManager().log( LogService.LOG_ERROR,
                     "DependencyManager : Suitable but non-accessible method found in class " + targetClass.getName(),
-                    null, null );
+                    null );
                 break;
             }
 
@@ -176,7 +176,7 @@
         }
         catch ( IllegalStateException ise )
         {
-            getComponentManager().log( LogService.LOG_INFO, ise.getMessage(), null, null );
+            getComponentManager().log( LogService.LOG_INFO, ise.getMessage(), null );
             return false;
         }
         catch ( IllegalAccessException ex )
@@ -184,21 +184,21 @@
             // 112.3.1 If the method is not is not declared protected or
             // public, SCR must log an error message with the log service,
             // if present, and ignore the method
-            getComponentManager().log( LogService.LOG_DEBUG, "Method " + m_methodName + " cannot be called", null, ex );
+            getComponentManager().log( LogService.LOG_DEBUG, "Method " + m_methodName + " cannot be called", ex );
         }
         catch ( InvocationTargetException ex )
         {
             // 112.5.7 If a bind method throws an exception, SCR must log an
             // error message containing the exception [...]
             getComponentManager().log( LogService.LOG_ERROR,
-                "The " + getMethodName() + " method has thrown an exception", null, ex.getCause() );
+                "The " + getMethodName() + " method has thrown an exception", ex.getCause() );
             return false;
         }
         catch ( Throwable t )
         {
             // anything else went wrong, log the message and fail the invocation
             getComponentManager().log( LogService.LOG_ERROR, "The " + getMethodName() + " method could not be called",
-                null, t );
+                t );
 
             // method invocation threw, so it was a failure
             return false;
@@ -393,7 +393,7 @@
         public boolean invoke( final Object componentInstance, final Object rawParameter )
         {
             getComponentManager().log( LogService.LOG_DEBUG,
-                "getting " + getMethodNamePrefix() + "bind: " + m_methodName, null, null );
+                "getting " + getMethodNamePrefix() + "bind: " + m_methodName, null );
             try
             {
                 m_method = findMethod();
@@ -404,8 +404,7 @@
             {
                 m_state = new NotFound();
                 // We can safely ignore this one
-                getComponentManager().log( LogService.LOG_WARNING, getMethodName() + " cannot be found", null,
-                    ex.getTargetException() );
+                getComponentManager().log( LogService.LOG_WARNING, getMethodName() + " cannot be found", ex.getTargetException() );
             }
             return true;
         }
@@ -420,7 +419,7 @@
             // message with the log service, if present, and ignore the
             // method
             getComponentManager().log( LogService.LOG_ERROR,
-                getMethodNamePrefix() + "bind method [" + m_methodName + "] not found", null, null );
+                getMethodNamePrefix() + "bind method [" + m_methodName + "] not found", null );
             return true;
         }
     }
@@ -431,7 +430,7 @@
         public boolean invoke( final Object componentInstance, final Object rawParameter )
         {
             getComponentManager().log( LogService.LOG_DEBUG,
-                "invoking " + getMethodNamePrefix() + "bind: " + m_methodName, null, null );
+                "invoking " + getMethodNamePrefix() + "bind: " + m_methodName, null );
             return invokeMethod( componentInstance, rawParameter );
         }
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
index 209255c..c7418a5 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/helper/BindMethod.java
@@ -165,8 +165,7 @@
         if ( suitableMethodNotAccessible )
         {
             getComponentManager().log( LogService.LOG_ERROR,
-                "DependencyManager : Suitable but non-accessible method found in class " + targetClass.getName(), null,
-                null );
+                "DependencyManager : Suitable but non-accessible method found in class " + targetClass.getName(), null );
             throw new SuitableMethodNotAccessibleException();
         }
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
index 4015d08..6cdba29 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
@@ -121,41 +121,41 @@
         {
             acm.log( LogService.LOG_DEBUG,
                     "Current state: " + m_name + ", Event: enable",
-                    acm.getComponentMetadata(), null );
+                    null );
         }
 
         void disableInternal( AbstractComponentManager acm )
         {
             acm.log( LogService.LOG_DEBUG,
                     "Current state: " + m_name + ", Event: disable",
-                    acm.getComponentMetadata(), null );
+                    null );
         }
 
         void activateInternal( AbstractComponentManager acm )
         {
             acm.log(LogService.LOG_DEBUG,
                     "Current state: " + m_name + ", Event: activate",
-                    acm.getComponentMetadata(), null);
+                    null);
         }
 
         void deactivateInternal( AbstractComponentManager acm, int reason )
         {
             acm.log( LogService.LOG_DEBUG, "Current state: " + m_name + ", Event: deactivate (reason: " + reason + ")",
-                acm.getComponentMetadata(), null );
+                null );
         }
 
         void disposeInternal( AbstractComponentManager acm )
         {
             acm.log( LogService.LOG_DEBUG,
                     "Current state: " + m_name + ", Event: dispose",
-                    acm.getComponentMetadata(), null );
+                    null );
         }
 
         Object getService( DelayedComponentManager dcm )
         {
             dcm.log( LogService.LOG_DEBUG,
                     "Current state: " + m_name + ", Event: getService",
-                    dcm.getComponentMetadata(), null );
+                    null );
             return null;
         }
     }
@@ -193,7 +193,7 @@
         {
             acm.changeState( Enabled.getInstance() );
 
-            acm.log( LogService.LOG_DEBUG, "Component enabled", acm.getComponentMetadata(), null );
+            acm.log( LogService.LOG_DEBUG, "Component enabled", null );
         }
 
         void disposeInternal( AbstractComponentManager acm )
@@ -228,7 +228,7 @@
             }
             catch (Exception e)
             {
-                acm.log( LogService.LOG_ERROR, "Failed enabling Component", componentMetadata, e );
+                acm.log( LogService.LOG_ERROR, "Failed enabling Component", e );
                 acm.disposeDependencyManagers();
                 acm.loadDependencyManagers( acm.getComponentMetadata() );
             }
@@ -238,7 +238,7 @@
         {
             acm.changeState( Disabled.getInstance() );
 
-            acm.log( LogService.LOG_DEBUG, "Component disabled", acm.getComponentMetadata(), null );
+            acm.log( LogService.LOG_DEBUG, "Component disabled", null );
         }
 
         void disposeInternal( AbstractComponentManager acm )
@@ -246,7 +246,7 @@
             acm.clear();
             acm.changeState( Destroyed.getInstance() );
 
-            acm.log( LogService.LOG_DEBUG, "Component disposed", acm.getComponentMetadata(), null );
+            acm.log( LogService.LOG_DEBUG, "Component disposed", null );
         }
     }
 
@@ -269,14 +269,13 @@
             acm.changeState( Activating.getInstance() );
 
             ComponentMetadata componentMetadata = acm.getComponentMetadata();
-            acm.log( LogService.LOG_DEBUG, "Activating component", componentMetadata, null );
+            acm.log( LogService.LOG_DEBUG, "Activating component", null );
 
             // Before creating the implementation object, we are going to
             // test if we have configuration if such is required
             if ( !acm.hasConfiguration() && acm.getComponentMetadata().isConfigurationRequired() )
             {
-                acm.log( LogService.LOG_INFO, "Missing required configuration, cannot activate", componentMetadata,
-                    null );
+                acm.log( LogService.LOG_INFO, "Missing required configuration, cannot activate", null );
                 acm.changeState( Unsatisfied.getInstance() );
                 return;
             }
@@ -285,7 +284,7 @@
             // test if all the mandatory dependencies are satisfied
             if ( !acm.verifyDependencyManagers( acm.getProperties()) )
             {
-                acm.log( LogService.LOG_INFO, "Not all dependencies satisified, cannot activate", componentMetadata, null );
+                acm.log( LogService.LOG_INFO, "Not all dependencies satisified, cannot activate", null );
                 acm.changeState( Unsatisfied.getInstance() );
                 return;
             }
@@ -298,7 +297,7 @@
             {
                 // component creation failed, not active now
                 acm.log( LogService.LOG_ERROR, "Component instance could not be created, activation failed",
-                        componentMetadata, null );
+                        null );
 
                 // set state to unsatisfied
                 acm.changeState( Unsatisfied.getInstance() );
@@ -313,7 +312,7 @@
         void disableInternal( AbstractComponentManager acm )
         {
             ComponentMetadata componentMetadata = acm.getComponentMetadata();
-            acm.log( LogService.LOG_DEBUG, "Disabling component", componentMetadata, null );
+            acm.log( LogService.LOG_DEBUG, "Disabling component", null );
 
             // dispose and recreate dependency managers
             acm.disposeDependencyManagers();
@@ -322,7 +321,7 @@
             // we are now disabled, ready for re-enablement or complete destroyal
             acm.changeState( Disabled.getInstance() );
 
-            acm.log( LogService.LOG_DEBUG, "Component disabled", componentMetadata, null );
+            acm.log( LogService.LOG_DEBUG, "Component disabled", null );
         }
 
         void disposeInternal( AbstractComponentManager acm )
@@ -331,7 +330,7 @@
             acm.clear();
             acm.changeState( Destroyed.getInstance() );
 
-            acm.log( LogService.LOG_DEBUG, "Component disposed", acm.getComponentMetadata(), null );
+            acm.log( LogService.LOG_DEBUG, "Component disposed", null );
         }
     }
 
@@ -380,7 +379,7 @@
             acm.changeState(Deactivating.getInstance());
 
             ComponentMetadata componentMetadata = acm.getComponentMetadata();
-            acm.log( LogService.LOG_DEBUG, "Deactivating component", componentMetadata, null );
+            acm.log( LogService.LOG_DEBUG, "Deactivating component", null );
 
             // catch any problems from deleting the component to prevent the
             // component to remain in the deactivating state !
@@ -391,11 +390,11 @@
             }
             catch ( Throwable t )
             {
-                acm.log( LogService.LOG_WARNING, "Component deactivation threw an exception", componentMetadata, t );
+                acm.log( LogService.LOG_WARNING, "Component deactivation threw an exception", t );
             }
 
             acm.changeState( Unsatisfied.getInstance() );
-            acm.log( LogService.LOG_DEBUG, "Component deactivated", componentMetadata, null );
+            acm.log( LogService.LOG_DEBUG, "Component deactivated", null );
         }
     }
 
@@ -477,7 +476,7 @@
         m_state = Disabled.getInstance();
         loadDependencyManagers( metadata );
 
-        log( LogService.LOG_DEBUG, "Component created", metadata, null );
+        log( LogService.LOG_DEBUG, "Component created", null );
     }
 
 
@@ -718,7 +717,7 @@
     {
         if ( getComponentMetadata().getServiceMetadata() != null )
         {
-            log( LogService.LOG_DEBUG, "registering services", m_componentMetadata, null );
+            log( LogService.LOG_DEBUG, "registering services", null );
 
             // get a copy of the component properties as service properties
             final Dictionary serviceProperties = getServiceProperties();
@@ -742,7 +741,7 @@
 
         if ( m_serviceRegistration != null )
         {
-            log( LogService.LOG_DEBUG, "unregistering the services", m_componentMetadata, null );
+            log( LogService.LOG_DEBUG, "unregistering the services", null );
 
             m_serviceRegistration.unregister();
             m_serviceRegistration = null;
@@ -774,12 +773,12 @@
     }
 
 
-    public void log( int level, String message, ComponentMetadata metadata, Throwable ex )
+    public void log( int level, String message, Throwable ex )
     {
         BundleComponentActivator activator = getActivator();
         if ( activator != null )
         {
-            activator.log( level, message, metadata, ex );
+            activator.log( level, message, getComponentMetadata(), ex );
         }
     }
 
@@ -872,7 +871,7 @@
             if ( !dm.isSatisfied() )
             {
                 // at least one dependency is not satisfied
-                log( LogService.LOG_INFO, "Dependency not satisfied: " + dm.getName(), m_componentMetadata, null );
+                log( LogService.LOG_INFO, "Dependency not satisfied: " + dm.getName(), null );
                 satisfied = false;
             }
         }
@@ -1020,7 +1019,7 @@
     {
         log( LogService.LOG_DEBUG,
                 "State transition : " + m_state + " -> " + newState,
-                m_componentMetadata, null );
+                null );
 
         m_state = newState;
     }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
index 25db7e0..de5e7c8 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
@@ -153,7 +153,7 @@
 
     protected ServiceRegistration registerService()
     {
-        log( LogService.LOG_DEBUG, "registering component factory", getComponentMetadata(), null );
+        log( LogService.LOG_DEBUG, "registering component factory", null );
 
         Dictionary serviceProperties = getProperties();
         return getActivator().getBundleContext().registerService( new String[]
@@ -220,8 +220,7 @@
             ImmediateComponentManager cm = ( ImmediateComponentManager ) m_configuredServices.remove( pid );
             if ( cm != null )
             {
-                log( LogService.LOG_DEBUG, "Disposing component after configuration deletion", getComponentMetadata(),
-                    null );
+                log( LogService.LOG_DEBUG, "Disposing component after configuration deletion", null );
 
                 cm.dispose();
             }
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
index 14c7174..c126e07 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
@@ -108,8 +108,7 @@
         setTargetFilter( m_dependencyMetadata.getTarget() );
 
         m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager " + getName() + " created: filter="
-            + getTarget() + ", interface=" + m_dependencyMetadata.getInterface(), m_componentManager
-            .getComponentMetadata(), null );
+            + getTarget() + ", interface=" + m_dependencyMetadata.getInterface(), null );
     }
 
     /**
@@ -149,7 +148,7 @@
         {
             case ServiceEvent.REGISTERED:
                 m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Adding " + serviceString,
-                    m_componentManager.getComponentMetadata(), null );
+                    null );
 
                 // consider the service if the filter matches
                 if ( targetFilterMatch( ref ) )
@@ -161,13 +160,13 @@
                 {
                     m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Ignoring added Service for "
                         + m_dependencyMetadata.getName() + " : does not match target filter " + getTarget(),
-                        m_componentManager.getComponentMetadata(), null );
+                        null );
                 }
                 break;
 
             case ServiceEvent.MODIFIED:
                 m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Updating " + serviceString,
-                    m_componentManager.getComponentMetadata(), null );
+                    null );
 
                 // remove the service first
                 // only continue with further event handling if the service
@@ -192,7 +191,7 @@
 
             case ServiceEvent.UNREGISTERING:
                 m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Removing " + serviceString,
-                    m_componentManager.getComponentMetadata(), null );
+                    null );
 
                 // manage the service counter if the filter matchs
                 if ( targetFilterMatch( ref ) )
@@ -203,8 +202,7 @@
                 {
                     m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Not counting Service for "
                         + m_dependencyMetadata.getName() + " : Service " + ref.getProperty( Constants.SERVICE_ID )
-                        + " does not match target filter " + getTarget(), m_componentManager.getComponentMetadata(),
-                        null );
+                        + " does not match target filter " + getTarget(), null );
                 }
 
                 // remove the service ignoring the filter match because if the
@@ -235,8 +233,7 @@
         if ( m_componentManager.getState() == AbstractComponentManager.STATE_ENABLED )
         {
             m_componentManager.log( LogService.LOG_INFO, "Dependency Manager: Service "
-                + m_dependencyMetadata.getName() + " registered, activate component", m_componentManager
-                .getComponentMetadata(), null );
+                + m_dependencyMetadata.getName() + " registered, activate component", null );
 
             m_componentManager.activate();
         }
@@ -251,8 +248,7 @@
             if ( m_dependencyMetadata.isStatic() )
             {
                 m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Added service "
-                    + m_dependencyMetadata.getName() + " is ignored for static reference", m_componentManager
-                    .getComponentMetadata(), null );
+                    + m_dependencyMetadata.getName() + " is ignored for static reference", null );
             }
 
             // otherwise bind if we have a bind method and the service needs
@@ -273,7 +269,7 @@
             m_componentManager.log( LogService.LOG_DEBUG,
 					"Dependency Manager: Ignoring service addition, wrong state "
 					+ m_componentManager.state(),
-					m_componentManager.getComponentMetadata(), null );
+					null );
         }
     }
 
@@ -303,7 +299,7 @@
         {
             m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Ignoring removed Service for "
                 + m_dependencyMetadata.getName() + " : Service " + reference.getProperty( Constants.SERVICE_ID )
-                + " not bound", m_componentManager.getComponentMetadata(), null );
+                + " not bound", null );
 
             // service was not bound, we can continue without interruption
             return true;
@@ -339,14 +335,14 @@
                 {
                     m_componentManager.log( LogService.LOG_DEBUG, "Dependency Manager: Static dependency on "
                         + m_dependencyMetadata.getName() + "/" + m_dependencyMetadata.getInterface() + " is broken",
-                        m_componentManager.getComponentMetadata(), null );
+                        null );
                     m_componentManager.deactivateInternal( ComponentConstants.DEACTIVATION_REASON_REFERENCE );
                     m_componentManager.activate();
                 }
                 catch ( Exception ex )
                 {
                     m_componentManager.log( LogService.LOG_ERROR, "Exception while recreating dependency ",
-                        m_componentManager.getComponentMetadata(), ex );
+                        ex );
                 }
 
                 // static reference removal causes reactivation, nothing more to do
@@ -368,7 +364,7 @@
                         m_componentManager.log( LogService.LOG_DEBUG,
                             "Dependency Manager: Deactivating component due to mandatory dependency on "
                                 + m_dependencyMetadata.getName() + "/" + m_dependencyMetadata.getInterface()
-                                + " not satisfied", m_componentManager.getComponentMetadata(), null );
+                                + " not satisfied", null );
                         m_componentManager.deactivateInternal( ComponentConstants.DEACTIVATION_REASON_REFERENCE );
 
                         // required service could not be replaced, component
@@ -393,7 +389,7 @@
             m_componentManager.log( LogService.LOG_DEBUG,
 					"Dependency Manager: Ignoring service removal, wrong state "
 					+ m_componentManager.state(),
-					m_componentManager.getComponentMetadata(), null );
+					null );
         }
 
         // everything is fine, the component is still active and we continue
@@ -469,7 +465,7 @@
         m_componentManager.getActivator().getBundleContext().addServiceListener( this, filterString );
 
         m_componentManager.log( LogService.LOG_DEBUG, "Registered for service events, currently " + m_size
-            + " service(s) match the filter", m_componentManager.getComponentMetadata(), null );
+            + " service(s) match the filter", null );
     }
 
     /**
@@ -540,7 +536,7 @@
         catch ( InvalidSyntaxException ise )
         {
             m_componentManager.log( LogService.LOG_ERROR, "Unexpected problem with filter '" + targetFilter + "'",
-                m_componentManager.getComponentMetadata(), ise );
+                ise );
             return null;
         }
     }
@@ -970,7 +966,7 @@
         {
             m_componentManager.log( LogService.LOG_DEBUG,
                 "DependencyManager : Delayed component not yet created, assuming bind method call succeeded",
-                m_componentManager.getComponentMetadata(), null );
+                null );
 
             return true;
         }
@@ -981,7 +977,7 @@
             // not a problem, because the open(Object) method will catch up
             // this services any way
             m_componentManager.log( LogService.LOG_DEBUG, "DependencyManager : Not yet open for activating component",
-                m_componentManager.getComponentMetadata(), null );
+                null );
 
             return true;
         }
@@ -992,7 +988,7 @@
 
             m_componentManager.log( LogService.LOG_ERROR,
                 "DependencyManager : Immediate component not yet created, bind method cannot be called",
-                m_componentManager.getComponentMetadata(), null );
+                null );
 
             return false;
         }
@@ -1038,8 +1034,7 @@
             // if the component instance has already been cleared by the
             // close() method
             m_componentManager.log( LogService.LOG_DEBUG,
-                "DependencyManager : Component not set, no need to call unbind method", m_componentManager
-                    .getComponentMetadata(), null );
+                "DependencyManager : Component not set, no need to call unbind method", null );
         }
     }
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
index bcd5d4a..153e18a 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
@@ -159,7 +159,7 @@
         {
             // failed to instantiate, return null
             log( LogService.LOG_ERROR, "Error during instantiation of the implementation object",
-                getComponentMetadata(), ex );
+                ex );
             return null;
         }
 
@@ -174,7 +174,7 @@
             if ( !dm.open( implementationObject ) )
             {
                 log( LogService.LOG_ERROR, "Cannot create component instance due to failure to bind reference "
-                    + dm.getName(), getComponentMetadata(), null );
+                    + dm.getName(), null );
 
                 // make sure, we keep no bindings
                 it = getDependencyManagers();
@@ -340,8 +340,7 @@
         // nothing to do if there is no configuration (see FELIX-714)
         if ( configuration == null && m_configurationProperties == null )
         {
-            log( LogService.LOG_DEBUG, "No configuration provided (or deleted), nothing to do", getComponentMetadata(),
-                null );
+            log( LogService.LOG_DEBUG, "No configuration provided (or deleted), nothing to do", null );
             return;
         }
 
@@ -375,7 +374,7 @@
         else if ( !modify() )
         {
             log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure from configuration",
-                getComponentMetadata(), null );
+                null );
             int reason = ( configuration == null ) ? ComponentConstants.DEACTIVATION_REASON_CONFIGURATION_DELETED
                 : ComponentConstants.DEACTIVATION_REASON_CONFIGURATION_MODIFIED;
             reactivate( reason );
@@ -408,7 +407,7 @@
             {
                 log( LogService.LOG_INFO,
                     "Cannot dynamically update the configuration due to dependency changes induced on dependency "
-                        + dm.getName(), getComponentMetadata(), null );
+                        + dm.getName(), null );
                 return false;
             }
         }
@@ -419,7 +418,7 @@
         {
             // log an error if the declared method cannot be found
             log( LogService.LOG_ERROR, "Declared modify method '" + getComponentMetadata().getModified()
-                + "' cannot be found, configuring by reactivation", getComponentMetadata(), null );
+                + "' cannot be found, configuring by reactivation", null );
             return false;
         }
 
@@ -431,7 +430,7 @@
             log(
                 LogService.LOG_ERROR,
                 "Updating the service references caused at least on reference to become unsatisifed, deactivating component",
-                getComponentMetadata(), null );
+                null );
             return false;
         }
 
@@ -452,12 +451,12 @@
             {
                 log( LogService.LOG_ERROR,
                     "Unexpected configuration property problem when updating service registration",
-                    getComponentMetadata(), iae );
+                    iae );
             }
             catch ( Throwable t )
             {
                 log( LogService.LOG_ERROR, "Unexpected problem when updating service registration",
-                    getComponentMetadata(), t );
+                    t );
             }
         }
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
index 60f1bb1..59552f5 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
@@ -94,7 +94,7 @@
      */
     public Object getService( Bundle bundle, ServiceRegistration registration )
     {
-        log( LogService.LOG_DEBUG, "ServiceFactory.getService()", getComponentMetadata(), null );
+        log( LogService.LOG_DEBUG, "ServiceFactory.getService()", null );
 
         // When the getServiceMethod is called, the implementation object must be created
 
@@ -130,7 +130,7 @@
      */
     public void ungetService( Bundle bundle, ServiceRegistration registration, Object service )
     {
-        log( LogService.LOG_DEBUG, "ServiceFactory.ungetService()", getComponentMetadata(), null );
+        log( LogService.LOG_DEBUG, "ServiceFactory.ungetService()", null );
 
         // When the ungetServiceMethod is called, the implementation object must be deactivated
 
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java b/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
index 5f4db52..28d4b9d 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
@@ -86,7 +86,7 @@
         return options( provision( scanDir( "target" ).filter( "*.jar" ), mavenBundle( "org.ops4j.pax.swissbox",
             "pax-swissbox-tinybundles", "1.0.0" ), mavenBundle( "org.apache.felix", "org.apache.felix.configadmin",
             "1.0.10" ) )
-        //            , PaxRunnerOptions.vmOption( "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=30303" )
+//                    , PaxRunnerOptions.vmOption( "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=30303" )
         //            PaxRunnerOptions.timeout( 0 )
 
         );
@@ -229,23 +229,31 @@
         component.enable();
         delay();
 
+        final SimpleComponent firstInstance = SimpleComponent.INSTANCE;
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
-        TestCase.assertNotNull( SimpleComponent.INSTANCE );
-        TestCase.assertNull( SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+        TestCase.assertNotNull( firstInstance );
+        TestCase.assertNull( firstInstance.getProperty( PROP_NAME ) );
 
         configure( pid );
         delay();
 
+        final SimpleComponent secondInstance = SimpleComponent.INSTANCE;
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
-        TestCase.assertNotNull( SimpleComponent.INSTANCE );
-        TestCase.assertEquals( PROP_NAME, SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+        TestCase.assertNotNull( secondInstance );
+        TestCase.assertEquals( PROP_NAME, secondInstance.getProperty( PROP_NAME ) );
+
 
         deleteConfig( pid );
         delay();
 
+        final SimpleComponent thirdInstance = SimpleComponent.INSTANCE;
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
-        TestCase.assertNotNull( SimpleComponent.INSTANCE );
-        TestCase.assertNull( SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+        TestCase.assertNotNull( thirdInstance );
+        TestCase.assertNull( thirdInstance.getProperty( PROP_NAME ) );
+
+        TestCase.assertNotSame( "Expect new instance object after reconfiguration", firstInstance, secondInstance );
+        TestCase.assertNotSame( "Expect new instance object after configuration deletion (1)", firstInstance, thirdInstance);
+        TestCase.assertNotSame( "Expect new instance object after configuration deletion (2)", secondInstance, thirdInstance);
 
         component.disable();
         delay();
@@ -316,6 +324,7 @@
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
         TestCase.assertNotNull( SimpleComponent.INSTANCE );
         TestCase.assertNull( SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+        TestCase.assertEquals( pid, SimpleComponent.INSTANCE.getProperty( Constants.SERVICE_PID ) );
 
         final SimpleComponent instance = SimpleComponent.INSTANCE;
 
@@ -325,6 +334,7 @@
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
         TestCase.assertEquals( instance, SimpleComponent.INSTANCE );
         TestCase.assertEquals( PROP_NAME, SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+        TestCase.assertEquals( pid, SimpleComponent.INSTANCE.getProperty( Constants.SERVICE_PID ) );
 
         deleteConfig( pid );
         delay();
@@ -332,6 +342,7 @@
         TestCase.assertEquals( Component.STATE_ACTIVE, component.getState() );
         TestCase.assertEquals( instance, SimpleComponent.INSTANCE );
         TestCase.assertNull( SimpleComponent.INSTANCE.getProperty( PROP_NAME ) );
+        TestCase.assertEquals( pid, SimpleComponent.INSTANCE.getProperty( Constants.SERVICE_PID ) );
 
         component.disable();
         delay();
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java b/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java
index ad0ecbe..b900190 100644
--- a/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java
@@ -22,7 +22,10 @@
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
+
 import org.osgi.framework.Constants;
 import org.osgi.service.component.ComponentContext;
 
@@ -34,6 +37,8 @@
 
     public static final Map<String, SimpleComponent> INSTANCES = new HashMap<String, SimpleComponent>();
 
+    public static final Set<SimpleComponent> PREVIOUS_INSTANCES = new HashSet<SimpleComponent>();
+
     private Map<?, ?> m_config;
 
 
@@ -41,8 +46,21 @@
     private void activate( Map<?, ?> config )
     {
         INSTANCE = this;
-        INSTANCES.put( (String) config.get( Constants.SERVICE_PID), this );
+        INSTANCES.put( config.get( Constants.SERVICE_PID ).toString(), this );
         setConfig( config );
+
+        if ( PREVIOUS_INSTANCES.contains( this ) )
+        {
+            System.err.println();
+            System.err.println( "An instance has been reused !!!" );
+            System.err.println( "Existing: " + PREVIOUS_INSTANCES );
+            System.err.println( "New     : " + this );
+            System.err.println();
+        }
+        else
+        {
+            PREVIOUS_INSTANCES.add( this );
+        }
     }
 
 
@@ -56,8 +74,9 @@
     @SuppressWarnings("unused")
     private void deactivate()
     {
-        INSTANCES.remove( getProperty( Constants.SERVICE_PID ));
+        INSTANCES.remove( getProperty( Constants.SERVICE_PID ).toString() );
         INSTANCE = null;
+        setConfig( new HashMap<Object, Object>() );
     }
 
 
@@ -70,7 +89,7 @@
     protected void setConfig( Dictionary<?, ?> config )
     {
         Map<Object, Object> configMap = new HashMap<Object, Object>();
-        for ( Enumeration<?> ce = config.elements(); ce.hasMoreElements(); )
+        for ( Enumeration<?> ce = config.keys(); ce.hasMoreElements(); )
         {
             Object key = ce.nextElement();
             Object value = config.get( key );
diff --git a/scr/src/test/resources/integration_test_simple_components.xml b/scr/src/test/resources/integration_test_simple_components.xml
index 412c810..d6a5af9 100644
--- a/scr/src/test/resources/integration_test_simple_components.xml
+++ b/scr/src/test/resources/integration_test_simple_components.xml
@@ -24,6 +24,7 @@
         enabled="false"
         configuration-policy="ignore">
         <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="SimpleComponent.configuration.ignore" />
     </scr:component>
 
     <!-- component takes configuration as available -->
@@ -31,6 +32,7 @@
         enabled="false"
         configuration-policy="optional" >
         <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="SimpleComponent.configuration.optional" />
     </scr:component>
 
     <!-- component requires configuration -->
@@ -38,12 +40,14 @@
         enabled="false"
         configuration-policy="require" >
         <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="SimpleComponent.configuration.require" />
     </scr:component>
 
     <!-- component dynamically updates configuration -->
     <scr:component name="DynamicConfigurationComponent"
         enabled="false" modified="configure">
         <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="DynamicConfigurationComponent" />
     </scr:component>
 
     <!-- component instances created by factory configuration -->
@@ -51,6 +55,7 @@
         enabled="false"
         configuration-policy="require" >
         <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="FactoryConfigurationComponent" />
     </scr:component>
 
     <!-- component is a stupid service to verify non-use of private props -->
@@ -58,6 +63,7 @@
         enabled="false" immediate="true"
         configuration-policy="ignore" >
         <implementation class="org.apache.felix.scr.integration.components.SimpleComponent" />
+        <property name="service.pid" value="ServiceComponent" />
         <property name="prop.public" value="required" />
         <property name=".prop.private" value="private" />
         <service>