FELIX-4293 Do not try to reconfigure based on CM_LOCATION_CHANGED events with null properties, although code does set the bundle location if null
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1536005 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
index 40ead7c..857e7c9 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
@@ -315,6 +315,11 @@
//this sets the location to this component's bundle if not already set. OK here
//since it used to be set to this bundle, ok to reset it
final ConfigurationInfo configInfo = getConfigurationInfo( pid, componentHolder, bundleContext );
+ if (configInfo.getProps() == null)
+ {
+ throw new IllegalStateException("Existing Configuration with pid " + pid +
+ " has had its properties set to null and location changed. We expected a delete event first.");
+ }
//this config was used on this component. Does it still match?
if (!checkBundleLocation( configInfo.getBundleLocation(), bundleContext.getBundle() ))
{
@@ -333,6 +338,11 @@
//this sets the location to this component's bundle if not already set. OK here
//because if it is set to this bundle we will use it.
final ConfigurationInfo configInfo = getConfigurationInfo( pid, componentHolder, bundleContext );
+ if (configInfo.getProps() == null)
+ {
+ //location has been changed before any properties are set. We don't care. Wait for an updated event with the properties
+ break;
+ }
//this component was not configured with this config. Should it be now?
if ( checkBundleLocation( configInfo.getBundleLocation(), bundleContext.getBundle() ) )
{