NPE if installed JAR is not a bundle; check for it now. (FELIX-29)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@771010 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java b/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java
index ffcd219..af88da5 100644
--- a/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java
+++ b/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java
@@ -70,16 +70,23 @@
if (!host.isResolved() && !Util.isFragment(host))
{
ICapability[] caps = host.getCapabilities();
- ICapability bundleCap = null;
+ ICapability hostCap = null;
for (int capIdx = 0; capIdx < caps.length; capIdx++)
{
if (caps[capIdx].getNamespace().equals(ICapability.HOST_NAMESPACE))
{
- bundleCap = caps[capIdx];
+ hostCap = caps[capIdx];
break;
}
}
+ // If there is no host capability in the current module,
+ // then just ignore it.
+ if (hostCap == null)
+ {
+ continue;
+ }
+
// Need to remove any previously attached, but not resolved fragments.
// TODO: FRAGMENT - Would be better to have the previous resolves
// not leave fragments attached.
@@ -99,7 +106,7 @@
for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++)
{
if (reqs[reqIdx].getNamespace().equals(ICapability.HOST_NAMESPACE)
- && reqs[reqIdx].isSatisfied(bundleCap)
+ && reqs[reqIdx].isSatisfied(hostCap)
&& !((BundleImpl) fragments[fragIdx].getBundle()).isStale()
&& !((BundleImpl) fragments[fragIdx].getBundle()).isRemovalPending())
{