Fixed a bug (FELIX-143) that was causing an NPE due to the fact that the
findEntries() code was assuming that all bundles have content, but the
system bundle does not.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@462805 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java b/framework/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
index 1f73b6a..9dc1dc5 100644
--- a/framework/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
+++ b/framework/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
@@ -36,8 +36,8 @@
{
m_bundle = bundle;
m_path = path;
- m_enumeration = m_bundle.getInfo().getCurrentModule()
- .getContentLoader().getContent().getEntries();
+ m_enumeration = (m_bundle.getInfo().getCurrentModule().getContentLoader().getContent() == null)
+ ? null : m_bundle.getInfo().getCurrentModule().getContentLoader().getContent().getEntries();
m_recurse = recurse;
// Sanity check the parameters.
@@ -86,7 +86,7 @@
// it only displays the contents of the directory specified by
// the path argument either recursively or not; much like using
// "ls -R" or "ls" to list the contents of a directory, respectively.
- while (m_enumeration.hasMoreElements())
+ while ((m_enumeration != null) && m_enumeration.hasMoreElements())
{
// Get the next entry name.
String entryName = (String) m_enumeration.nextElement();