Fixed Felix-2981
Applied the patch from Robert Lillack

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1178159 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
index 2b68234..5dac071 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
@@ -435,6 +435,14 @@
             }
         }
 
+        // Every removed configurable propery gets reset to its default value
+        for (int i = 0; i < m_configurableProperties.size(); i++) {
+            Property prop = (Property) m_configurableProperties.get(i);
+            if (configuration.get(prop.getName()) == null) {
+                reconfigureProperty(prop, prop.getDefaultValue());
+            }
+        }
+
         return toPropagate;
 
     }
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
index 9bc363d..52c11c2 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
@@ -431,7 +431,7 @@
      * @param obj the service object if the service was get

      */

     private void manageDeparture(ServiceReference ref, Object obj) {

-    	// Unget the service reference

+        // Unget the service reference

         ungetService(ref);

 

         // If we already get this service and the binding policy is static, the dependency becomes broken

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
index 63395cd..c2d457f 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Property.java
@@ -75,6 +75,11 @@
     private Object m_value = NO_VALUE;

 

     /**

+     * The default value of the property.

+     */

+    private Object m_defaultValue = NO_VALUE;

+

+    /**

      * Flag tracking is the method was

      * already called for the current value.

      */

@@ -126,6 +131,7 @@
         m_type = computeType(type, manager.getGlobalContext());

         if (value != null) {

             m_value = create(m_type, value);

+            m_defaultValue = m_value;

         }

 

         if (method != null) {

@@ -136,9 +142,9 @@
     }

 

     public Property(String name, String field, String method, int index,

-    		String value, String type, InstanceManager manager, Handler handler) throws ConfigurationException {

-    	this(name, field, method, value, type, manager, handler);

-    	m_index = index;

+            String value, String type, InstanceManager manager, Handler handler) throws ConfigurationException {

+        this(name, field, method, value, type, manager, handler);

+        m_index = index;

     }

 

     /**

@@ -277,7 +283,7 @@
      * parameter.

      */

     public int getParameterIndex() {

-    	return m_index;

+        return m_index;

     }

 

     /**

@@ -292,6 +298,17 @@
         return m_value;

     }

 

+    /**

+     * Gets the initial value of the property.

+     * @return the default value.

+     */

+    public Object getDefaultValue() {

+        if (m_defaultValue == NO_VALUE) {

+            return getNoValue(m_type);

+        }

+

+        return m_defaultValue;

+    }

 

     /**

      * Gets the NO VALUE Object.

@@ -523,7 +540,7 @@
      * it will be invoked another times.

      */

     public synchronized void reset() {

-    	m_invoked = false;

+        m_invoked = false;

     }

 

     /**

@@ -596,30 +613,30 @@
      * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameter(int)

      */

     public Object getConstructorParameter(int index) {

-    	if (m_index != index) {

-    		return null;

-    	}

+        if (m_index != index) {

+            return null;

+        }

 

-    	if (m_value  == NO_VALUE) {

+        if (m_value  == NO_VALUE) {

            return getNoValue(m_type);

         }

         return m_value;

-	}

+    }

 

-	/**

-	 * Gets the type of the constructor parameter to inject.

-	 * @param index the parameter index

-	 * @return the Class of the property.

-	 * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameterType(int)

-	 */

-	public Class getConstructorParameterType(int index) {

-		if (m_index != index) {

-    		return null;

-    	}

-		return m_type;

-	}

+    /**

+     * Gets the type of the constructor parameter to inject.

+     * @param index the parameter index

+     * @return the Class of the property.

+     * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameterType(int)

+     */

+    public Class getConstructorParameterType(int index) {

+        if (m_index != index) {

+            return null;

+        }

+        return m_type;

+    }

 

-	/**

+    /**

      * Gets the handler managing the property.

      * @return the configuration handler.

      */