FELIX-4223 minor cleanups

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1523554 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
index 598db65..4f47851 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
@@ -70,7 +70,7 @@
      * @param pid The PID of the configuration used to configure the component.
      * @param props the property dictionary from the configuration.
      * @param changeCount change count of the configuration, or R4 imitation.
-     * @param targetedPid TODO
+     * @param targetedPid Targeted PID for the configuration
      * @return true if a new component is created for a factory PID, false if an existing factory pid configuration is updated or 
      * we have no factory pid
      */
@@ -78,14 +78,15 @@
     
     /**
      * Change count (or fake R4 imitation)
+     * @param pid PID of the component we are interested in.
      * @return the last change count from a configurationUpdated call for the given pid.
      */
     long getChangeCount( String pid );
     
     /**
      * Returns the targeted PID used to configure this component
-     * @param pid TODO
-     * @return
+     * @param pid a targetedPID containing the service pid for the component desired (the rest of the targeted pid is ignored)
+     * @return the complete targeted pid actually used to configure the comonent.
      */
     TargetedPID getConfigurationTargetedPID(TargetedPID pid);
 
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
index 71a23b6..4599118 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
@@ -513,7 +513,7 @@
      *
      * @param ca Configuration Admin service
      * @param pid Pid for desired configuration
-     * @param bundle TODO
+     * @param bundle bundle of the component we are configuring (used in targeted pids)
      * @return configuration with the specified Pid
      */
     public Configuration findSingletonConfiguration(final ConfigurationAdmin ca, final String pid, Bundle bundle)
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 4c701cf..a1aa66f 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
@@ -91,7 +91,7 @@
     /**
      * Constructor that receives several parameters.
      * @param dependency An object that contains data about the dependency
-     * @param index TODO
+     * @param index index of the dependency manager in the metadata
      */
     DependencyManager( AbstractComponentManager<S> componentManager, ReferenceMetadata dependency, int index )
     {
@@ -272,7 +272,7 @@
         {
             boolean success = m_dependencyMetadata.isOptional() || !getTracker().isEmpty();
             AtomicInteger trackingCount = new AtomicInteger( );
-            getTracker().getTracked( true, trackingCount );   //TODO activate method??
+            getTracker().getTracked( true, trackingCount );
             return success;
         }
 
@@ -1395,7 +1395,7 @@
     /**
      * initializes a dependency. This method binds all of the service
      * occurrences to the instance object
-     * @param edgeInfo TODO
+     * @param edgeInfo Edge info for the combination of this component instance and this dependency manager.
      *
      * @return true if the dependency is satisfied and at least the minimum
      *      number of services could be bound. Otherwise false is returned.
@@ -1457,7 +1457,8 @@
     /**
      * Revoke the given bindings. This method cannot throw an exception since
      * it must try to complete all that it can
-     * @param edgeInfo TODO
+     * @param componentInstance instance we are unbinding from.
+     * @param edgeInfo EdgeInfo for the combination of this component instance and this dependency manager.
      */
     void close( S componentInstance, EdgeInfo edgeInfo )
     {
@@ -1534,10 +1535,10 @@
      *
      *
      *
-     * @param componentInstance
+     * @param componentInstance instance we are binding to
      * @param refPair the service reference, service object tuple.
-     * @param trackingCount
-     * @param edgeInfo TODO
+     * @param trackingCount service event counter for this service.
+     * @param edgeInfo EdgeInfo for the combination of this instance and this dependency manager.
      * @return true if the service should be considered bound. If no bind
      *      method is found or the method call fails, <code>true</code> is
      *      returned. <code>false</code> is only returned if the service must
@@ -1587,9 +1588,9 @@
     /**
      * Calls the updated method.
      *
-     * @param componentInstance
+     * @param componentInstance instance we are calling updated on.
      * @param refPair A service reference corresponding to the service whose service
-     * @param edgeInfo TODO
+     * @param edgeInfo EdgeInfo for the comibination of this instance and this dependency manager.
      */
     void invokeUpdatedMethod( S componentInstance, final RefPair<T> refPair, int trackingCount, EdgeInfo info )
     {
@@ -1669,10 +1670,10 @@
      * to the component this method has no effect and just returns
      * <code>true</code>.
      *
-     * @param componentInstance
-     * @param refPair A service reference corresponding to the service that will be
-     * @param trackingCount
-     * @param info TODO
+     * @param componentInstance instance we are unbinding from
+     * @param refPair A service reference, service pair that will be unbound
+     * @param trackingCount service event count for this reference
+     * @param info EdgeInfo for the combination of this instance and this dependency manager
      */
     void invokeUnbindMethod( S componentInstance, final RefPair<T> refPair, int trackingCount, EdgeInfo info )
     {
@@ -1680,8 +1681,12 @@
         // null. This is valid for both immediate and delayed components
         if ( componentInstance != null )
         {
-            //TODO needs sync on getTracker().tracked()
-            if (info.outOfRange( trackingCount ) )
+            boolean outOfRange;
+            synchronized ( m_tracker.tracked() )
+            {
+                outOfRange = info.outOfRange( trackingCount );
+            }
+            if ( outOfRange )
             {
                 //wait for unbinds to complete
                 if (info.getCloseLatch() != null)
@@ -1906,8 +1911,19 @@
             {
                 m_componentManager.log( LogService.LOG_ERROR, "Invalid syntax in target property for dependency {0} to {1}", new Object[]
                         {getName(), target}, null );
-                // TODO this is an error, how do we recover?
-                return; //avoid an NPE
+                
+                //create a filter that will never be satisfied
+                filterString = "(component.id=-1)";
+                try
+                {
+                    m_targetFilter = bundleContext.createFilter( filterString );
+                }
+                catch ( InvalidSyntaxException e )
+                {
+                    //this should not happen
+                    return;
+                }
+
             }
         }
         else
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 df9077a..b3e5373 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
@@ -529,8 +529,8 @@
      * @param configuration The configuration properties for the component from
      *                      the Configuration Admin Service or <code>null</code> if there is
      *                      no configuration or if the configuration has just been deleted.
-     * @param changeCount TODO
-     * @param targetedPID TODO
+     * @param changeCount Change count for the configuration
+     * @param targetedPID TargetedPID for the configuration
      */
     public void reconfigure( Dictionary<String, Object> configuration, long changeCount, TargetedPID targetedPID )
     {