Fixed FELIX-2902
Before adding a service property by propagation, checks whether the property is not already existing.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1089186 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
index 38e5697..cfbf244 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
@@ -485,12 +485,21 @@
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
Object value = props.get(key);
- Property prop;
- try {
- prop = new Property(key, null, null, value.toString(), value.getClass().getName(), getInstanceManager(), m_handler);
- addProperty(prop);
- } catch (ConfigurationException e) {
- m_handler.error("The propagated property " + key + " cannot be created correctly : " + e.getMessage());
+
+ boolean alreadyExisting = false;
+ for (int i = 0; i < m_properties.length; i++) {
+ if (key.equals(m_properties[i].getName())) {
+ alreadyExisting = true;
+ }
+ }
+
+ if (! alreadyExisting) {
+ try {
+ Property prop = new Property(key, null, null, value.toString(), value.getClass().getName(), getInstanceManager(), m_handler);
+ addProperty(prop);
+ } catch (ConfigurationException e) {
+ m_handler.error("The propagated property " + key + " cannot be created correctly : " + e.getMessage());
+ }
}
}
}