Hi all,

The behavior of Component.getServiceProperties() changed in the r11
release. Since this release the getServiceProperties method returns null if
instead of an emtpy dictionary, this seems to be in-line with the javadoc
(@return the properties or <code>null</code> if there are none) but it used
to return the emtpty dictionary in the past.

We have some errors due to this in several of our projects as in the past
initializing a component with emtpy properties was a nice way to make sure
that you never got a null from component.getServiceProperties().

If you do something like (simplified)
Component component = m_dependencyManager
.createComponent().setInterface(ApplicationService.class.getName(), new
Properties())
component.getServiceProperties().put("a", "b");

This now results in an NPE.

Had a quick look at the history and I think the change is due to the fix
for this FELIX-5636 [1], on github [2].

Long story, I'm mainly wondering if the change in behavior is intentional
or not.

Regards,
Bram

[1] https://issues.apache.org/jira/browse/FELIX-5636
[2]
https://github.com/apache/felix/commit/cfb4f0daccd8d940b6acc069b7376f2dd9e92395#diff-d4572933aed00f00ea9594c93598d2f2L682

Reply via email to