felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r926998 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
Date Wed, 24 Mar 2010 10:01:10 GMT
Author: fmeschbe
Date: Wed Mar 24 10:01:09 2010
New Revision: 926998

URL: http://svn.apache.org/viewvc?rev=926998&view=rev
Log:
FELIX-2230 Prevent calling a method on a null component instance thus preventing NullPointerException

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java?rev=926998&r1=926997&r2=926998&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/helper/BaseMethod.java Wed Mar
24 10:01:09 2010
@@ -209,8 +209,17 @@ abstract class BaseMethod
     {
         try
         {
-            final Object[] params = getParameters( m_method, rawParameter );
-            m_method.invoke( componentInstance, params );
+            if ( componentInstance != null )
+            {
+                final Object[] params = getParameters( m_method, rawParameter );
+                m_method.invoke( componentInstance, params );
+            }
+            else
+            {
+                getComponentManager().log( LogService.LOG_WARNING, "Method {0} cannot be
called on null object",
+                    new Object[]
+                        { getMethodName() }, null );
+            }
         }
         catch ( IllegalStateException ise )
         {



Mime
View raw message