You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2014/08/07 10:10:11 UTC

[jira] [Resolved] (FELIX-4594) Propagation from dependencies overwrites service properties

     [ https://issues.apache.org/jira/browse/FELIX-4594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierre De Rop resolved FELIX-4594.
----------------------------------

    Resolution: Fixed

commited the suggested patch in dm 4.0.0 (in the sandbox), in rv 1616434.

Commited the org.apache.felix.dm/src/org/apache/felix/dm/impl/ComponentImpl.java and modifed the following test cases:

org.apache.felix.dm.itest/src/org/apache/felix/dm/itest/AdapterWithPropagationTest.java
org.apache.felix.dm.itest/src/org/apache/felix/dm/itest/AspectWithPropagationTest.java
org.apache.felix.dm.itest/src/org/apache/felix/dm/itest/ServiceDependencyPropagateTest.java

> Propagation from dependencies overwrites service properties
> -----------------------------------------------------------
>
>                 Key: FELIX-4594
>                 URL: https://issues.apache.org/jira/browse/FELIX-4594
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>    Affects Versions: dependencymanager-3.2.0
>            Reporter: Tuomas Kiviaho
>            Assignee: Pierre De Rop
>            Priority: Blocker
>             Fix For: dependencymanager-4.0.0
>
>
> ComponentImpl#calculateServiceProperties() method overwrites implicitly defined service properties those coming from propagated dependencies.
> {code}
> addTo(properties, m_serviceProperties);
> for (int i = 0; i < m_dependencies.size(); i++) {
> 	Dependency d = (Dependency) m_dependencies.get(i);
> 	if (d.isPropagated() && d.isAvailable()) {
> 		Dictionary dict = d.getProperties();
> 		addTo(properties, dict);
> 	}
> }
> {code}
> I think that it would be more appropriate to deal clashes so that service properties would be added AFTER dependency propagation inverting the overwrite. Traversal of dependencies should in my opinion be inverted as well.
> {code}
> for (int i = m_dependencies.size() - 1; i >= 0; i--) {
> 	Dependency d = (Dependency) m_dependencies.get(i);
> 	if (d.isPropagated() && d.isAvailable()) {
> 		Dictionary dict = d.getProperties();
> 		addTo(properties, dict);
> 	}
> }
> addTo(properties, m_serviceProperties);
> {code}
> My use case involves Service PID which is currently overwritten by propagated dependencies. I'd turn off propagation but @AdapterService (and @AspectService) annotation is missing such option that @BundleAdapterService is providing. I can't work around the issue (without patching) while using annotations so I increased the priority accordingly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)