You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by dj...@apache.org on 2012/10/16 20:22:20 UTC

svn commit: r1398912 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java

Author: djencks
Date: Tue Oct 16 18:22:19 2012
New Revision: 1398912

URL: http://svn.apache.org/viewvc?rev=1398912&view=rev
Log:
FELIX-3675 fix NPEs in updated and unbind method calls

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java?rev=1398912&r1=1398911&r2=1398912&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java Tue Oct 16 18:22:19 2012
@@ -1315,6 +1315,13 @@ public class DependencyManager implement
         if ( componentInstance != null )
         {
             RefPair refPair = ( RefPair ) ((Map )m_componentManager.getDependencyMap().get( this )).get( ref );
+            if (refPair == null)
+            {
+
+                //TODO should this be possible? If so, reduce or eliminate logging
+                m_componentManager.log( LogService.LOG_WARNING,
+                        "DependencyManager : invokeUpdatedMethod : Component set, but reference not present", null );
+            }
             MethodResult methodResult = m_bindMethods.getUpdated().invoke( componentInstance, refPair, MethodResult.VOID );
             if ( methodResult != null)
             {
@@ -1349,6 +1356,12 @@ public class DependencyManager implement
         if ( componentInstance != null )
         {
             RefPair refPair = ( RefPair ) ((Map )m_componentManager.getDependencyMap().get( this )).get( ref );
+            if (refPair == null)
+            {
+                //TODO should this be possible? If so, reduce or eliminate logging
+                m_componentManager.log( LogService.LOG_WARNING,
+                        "DependencyManager : invokeUnbindMethod : Component set, but reference not present", null );
+            }
             MethodResult methodResult = m_bindMethods.getUnbind().invoke( componentInstance, refPair, MethodResult.VOID );
             if ( methodResult != null )
             {