Author: rickhall
Date: Wed Mar 9 17:47:42 2011
New Revision: 1079908
URL: http://svn.apache.org/viewvc?rev=1079908&view=rev
Log:
If a capability is from a fragment, we must always try to attach it to
a host even it the fragment is already resolved, since fragment capabilities
are not usable by themself. (FELIX-2858)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java?rev=1079908&r1=1079907&r2=1079908&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
Wed Mar 9 17:47:42 2011
@@ -230,17 +230,21 @@ public class Candidates
{
Capability candCap = itCandCap.next();
- // If the candidate module is not resolved and not the current
- // module we are trying to populate, then try to populate the
- // candidate module as well.
+ // If the candidate module is a fragment, then always attempt
+ // to populate candidates for its dependency, since it must be
+ // attached to a host to be used. Otherwise, if the candidate
+ // module is not already resolved and is not the current module
+ // we are trying to populate, then populate the candidates for
+ // its dependencies as well.
// NOTE: Technically, we don't have to check to see if the
// candidate module is equal to the current module, but this
// saves us from recursing and also simplifies exceptions
messages
// since we effectively chain exception messages for each level
// of recursion; thus, any avoided recursion results in fewer
// exceptions to chain when an error does occur.
- if (!candCap.getModule().isResolved()
- && !candCap.getModule().equals(module))
+ if (Util.isFragment(candCap.getModule())
+ || (!candCap.getModule().isResolved()
+ && !candCap.getModule().equals(module)))
{
try
{
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java?rev=1079908&r1=1079907&r2=1079908&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
Wed Mar 9 17:47:42 2011
@@ -34,7 +34,6 @@ import org.osgi.framework.Version;
class WrappedModule implements Module
{
- private final String m_id;
private final Module m_module;
private final List<Module> m_fragments;
private List<Capability> m_cachedCapabilities = null;
@@ -42,7 +41,6 @@ class WrappedModule implements Module
public WrappedModule(Module module, List<Module> fragments)
{
- m_id = module.getId() + " [" + super.hashCode() + "]";
m_module = module;
m_fragments = fragments;
}
@@ -59,7 +57,7 @@ class WrappedModule implements Module
public String getId()
{
- return m_id;
+ return m_module.getId();
}
public List<Capability> getCapabilities()