felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r926989 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolder.java
Date Wed, 24 Mar 2010 09:30:08 GMT
Author: fmeschbe
Date: Wed Mar 24 09:30:08 2010
New Revision: 926989

URL: http://svn.apache.org/viewvc?rev=926989&view=rev
Log:
FELIX-2231 Prevent NullPointerException if configuration is updated/deleted after the held
components have already been disposed off

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolder.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolder.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolder.java?rev=926989&r1=926988&r2=926989&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolder.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfiguredComponentHolder.java
Wed Mar 24 09:30:08 2010
@@ -64,13 +64,16 @@ public class ConfiguredComponentHolder e
 
     /**
      * The special component used if there is no configuration or a singleton
-     * configuration. This field is always non-<code>null</code> and is first
-     * created in the constructor. As factory configurations are provided this
-     * instance may be configured or "deconfigured".
+     * configuration. This field is only <code>null</code> once all components
+     * held by this holder have been disposed off by
+     * {@link #disposeComponents(int)} and is first created in the constructor.
+     * As factory configurations are provided this instance may be configured
+     * or "deconfigured".
      * <p>
      * Expected invariants:
      * <ul>
-     * <li>This field is never <code>null</code></li>
+     * <li>This field is only <code>null</code> after disposal of all held
+     * components</li>
      * <li>The {@link #m_components} map is empty or the component pointed to
      * by this field is also contained in the map</li>
      * <ul>
@@ -119,6 +122,11 @@ public class ConfiguredComponentHolder e
      */
     public void configurationDeleted( final String pid )
     {
+        // FELIX-2231: nothing to do any more, all components have been disposed off
+        if (m_singleComponent == null) {
+            return;
+        }
+
         if ( pid.equals( getComponentName() ) )
         {
             // singleton configuration deleted
@@ -181,6 +189,11 @@ public class ConfiguredComponentHolder e
      */
     public void configurationUpdated( final String pid, final Dictionary props )
     {
+        // FELIX-2231: nothing to do any more, all components have been disposed off
+        if (m_singleComponent == null) {
+            return;
+        }
+
         if ( pid.equals( getComponentName() ) )
         {
             // singleton configuration has pid equal to component name



Mime
View raw message