FELIX-3675 fix NPEs in updated and unbind method calls
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1398912 13f79535-47bb-0310-9956-ffa450edef68
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 0b5bd42..d15fa77 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
@@ -1315,6 +1315,13 @@
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 @@
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 )
{