[ https://issues.apache.org/jira/browse/FELIX-5050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14902252#comment-14902252 ]
German Vega edited comment on FELIX-5050 at 9/22/15 9:09 AM:
-------------------------------------------------------------
I can propose a patch, but after some reading of the code I have two alternatives and I am not sure which one is best :
1) Modify ProvidedService.deleteProperties(Dictionary) to verify if a field is specified for the property, and in that case do not delete the property but just set its value to null ... this is similar to what is done in ProvidedService.addProperties(Dictionary)
2) Be finer, and do not propagate values for any declared service property, and let the ProvidedServiceHandler.reconfigure method do its work when it will be invoked later by the instance manager.
The main difference between the two alternatives is that the semantics of the reconfigure seems to be different for the ConfigurationHandler and ProvidedSerrviceHandler concerning properties not specified in the dictionary for the reconfiguration :
- The ConfigurationHandler propagation considers that a value that is not specified in the reconfiguration must be deleted (anyway this is the net effect of first deleting all the old values and then adding all the new values). This means that if a property is not specified in the reconfiguration dictionary it will be set to null.
- The ProvidedServiceHandler.reconfigure method validates if a new value is specified in the reconfiguration for a service property, if no new value is specified it just doesn't update the property. This means that if a property is not specified in the reconfiguration dictionary it will keep its old value.
The two alternatives are reasonable, and the patchs are relatively simple, so let just discuss which one to choose and I can dedicate time to propose the patch.
We also need to consider what happens when using the Configuration Admin because in that case only the ConfigurationHandler is invoked.
was (Author: gvega):
I can propose a patch, but after some reading of the code I have two alternatives and I am not sure which one is best :
1) Modify ProvidedService.deleteProperties(Dictionary) to verify if a field is specified for the property, and in that case do not delete the property but just set its value to null ... this is similar to what is done in ProvidedService.addProperties(Dictionary)
2) Be finer, and do not propagate values for any declared service property, and let the ProvidedServiceHandler.reconfigure method do its work when it will be invoked later by the instance manager.
The main difference between the two alternatives is that the semantics of the reconfigure seems to be different for the ConfigurationHandler and ProvidedSerrviceHandler concerning properties not specified in the dictionary for the reconfiguration :
- The ConfigurationHandler propagation considers that a value that is not specified in the reconfiguration must be deleted (anyway this is the net effect of fisrt deleting all the old values and then adding all the new values). This means that if a property is not specified in the reconfiguration dictionary it will be set to null.
- The ProvidedServiceHandler.reconfigure method validates if a new value is specified in the reconfiguration for a service property, if no new value is specified it just doesn't update the property. This means that if a property is not specified in the reconfiguration dictionary it will keep its old value.
The two alternatives are reasonable, and the patchs are relatively simple, so let just discuss which one to choose and I can dedicate time to propose the patch.
We also need to consider what happens when using the Configuration Admin because in that case only the ConfigurationHandler is invoked.
Post by German Vega (JIRA)Reconfiguring a component with mixing configurable properties and service properties injected fields produces an error
----------------------------------------------------------------------------------------------------------------------
Key: FELIX-5050
URL: https://issues.apache.org/jira/browse/FELIX-5050
Project: Felix
Issue Type: Bug
Components: iPOJO
Affects Versions: ipojo-runtime-1.12.1
Reporter: German Vega
Attachments: bugs.ipojo.property.reconfiguration.zip
When a component using BOTH configurable properties and service properties is reconfigured, the value of the field for the service property is not correctly injected.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)