Pierre De Rop created FELIX-5683:
------------------------------------
Summary: getServiceProperties returns null instead of empty
dictionary
Key: FELIX-5683
URL: https://issues.apache.org/jira/browse/FELIX-5683
Project: Felix
Issue Type: Bug
Components: Dependency Manager
Affects Versions: org.apache.felix.dependencymanager-r9
Reporter: Pierre De Rop
Assignee: Pierre De Rop
Priority: Minor
There are two issues:
1)
In the felix users mailing list (see [1]), Bram reported the following:
when you set a component service properties like this:
{code}
Component component =
m_dependencyManager.createComponent().setInterface(ApplicationService.class.getName(),new
Properties());
component.getServiceProperties().put("a", "b");
{code}
then you get a NPE because the component.getServiceProperties() method returns
null instead of the empty dictionary that has been set in the
setInterfaceMethod.
This is a regression made in r9 release, in the FELIX-5522 where a refactoring
was done regarding aspect service properties.
A fix can be made in order to behave like before (that is : avoid the NPE).
2)
Bram, I may be wrong but I think that one new issue is that the dictionary
returned by the getServiceProperties() method was so far (since the initial
version of felix dm 2.0.1) a copy of the service properties dictionary
maintained in the ComponentImpl, so if you would like to do set service
properties like this:
{code}
Component component =
m_dependencyManager.createComponent().setInterface(ApplicationService.class.getName(),new
Properties());
component.getServiceProperties().put("a", "b");
m_dependencyManager.add(component); // won't add "a=b" properties
{code}
then the "a" property will be set in the copy of the internal dictionary
returned by the getServiceProperties() method, and the "a=b" service properties
won't be set when the component is added in the m_dependencyManager.
So, if what I'm saying is correct and if you would like to see this new
behavior implemented, please open a new jira issue and I will manage to
implement it; thanks
PS: I'm now fixing the 1) regression, in order to avoid the NPE.
[1] http://www.mail-archive.com/users%40felix.apache.org/msg17939.html
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)