Even though getResources() from the module class loader should not return null,
we do return null internally when a cycle is detected, so we still need to be
prepared to see null internally. (FELIX-2629)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1001882 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
index 230b213..1d721f8 100644
--- a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
@@ -861,8 +861,7 @@
// The spec states that if the bundle cannot be resolved, then
// only the local bundle's resources should be searched. So we
// will ask the module's own class path.
- urls = getResourcesLocal(name);
- return urls;
+ return getResourcesLocal(name);
}
// Get the package of the target class/resource.
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
index 96d675c..7e3076d 100755
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
@@ -163,7 +163,7 @@
// If no resource was found, then we must throw an exception
// since the exporter for this package did not contain the
// requested class.
- if (!urls.hasMoreElements())
+ if ((urls == null) || !urls.hasMoreElements())
{
throw new ResourceNotFoundException(name);
}
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java
index 734ee46..124c45c 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java
@@ -145,7 +145,7 @@
if (m_packages.contains(pkgName))
{
Enumeration urls = m_exporter.getResourcesByDelegation(name);
- if (urls.hasMoreElements())
+ if ((urls != null) && urls.hasMoreElements())
{
return urls;
}