felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r734500 - /felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
Date Wed, 14 Jan 2009 19:59:58 GMT
Author: fmeschbe
Date: Wed Jan 14 11:59:58 2009
New Revision: 734500

URL: http://svn.apache.org/viewvc?rev=734500&view=rev
Log:
FELIX-740 Check ServiceReference's Bundle before using it, since the
service may be unregistered (hence the bundle is null) by the time
the configuration(s) should be provided

Modified:
    felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java

Modified: felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java?rev=734500&r1=734499&r2=734500&view=diff
==============================================================================
--- felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
(original)
+++ felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
Wed Jan 14 11:59:58 2009
@@ -854,12 +854,20 @@
                     return;
                 }
                 
+                Bundle serviceBundle = sr.getBundle();
+                if ( serviceBundle == null )
+                {
+                    log( LogService.LOG_INFO, "ServiceFactory for PID " + pid
+                        + " seems to already have been unregistered, not updating with configuration",
null );
+                    return;
+                }
+
                 // 104.3 Ignore duplicate PIDs from other bundles and report
                 // them to the log
                 // 104.4.1 No update call back for PID already bound to another
                 // bundle location
                 // 104.4.1 assign configuration to bundle if unassigned
-                String bundleLocation = sr.getBundle().getLocation();
+                String bundleLocation = serviceBundle.getLocation();
                 if ( cfg.getBundleLocation() == null )
                 {
                     cfg.setBundleLocation( bundleLocation );
@@ -867,7 +875,7 @@
                 else if ( !bundleLocation.equals( cfg.getBundleLocation() ) )
                 {
                     log( LogService.LOG_ERROR, "Cannot use configuration for " + pid + "
requested by bundle "
-                        + sr.getBundle().getLocation() + " but belongs to " + cfg.getBundleLocation(),
null );
+                        + serviceBundle.getLocation() + " but belongs to " + cfg.getBundleLocation(),
null );
                     return;
                 }
 
@@ -961,7 +969,15 @@
                 return;
             }
 
-            String bundleLocation = sr.getBundle().getLocation();
+            Bundle serviceBundle = sr.getBundle();
+            if ( serviceBundle == null )
+            {
+                log( LogService.LOG_INFO, "ManagedServiceFactory for factory PID " + factoryPid
+                    + " seems to already have been unregistered, not updating with factory",
null );
+                return;
+            }
+
+            String bundleLocation = serviceBundle.getLocation();
             if ( factory.getBundleLocation() == null )
             {
                 // bind to the location of the service if unbound
@@ -971,7 +987,7 @@
             {
                 // factory PID is bound to another bundle
                 log( LogService.LOG_ERROR, "Cannot use Factory configuration for " + factoryPid
-                    + " requested by bundle " + sr.getBundle().getLocation() + " but belongs
to "
+                    + " requested by bundle " + serviceBundle.getLocation() + " but belongs
to "
                     + factory.getBundleLocation(), null );
                 return;
             }



Mime
View raw message