diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index dc0d9c6..832e1e9 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -703,11 +703,6 @@
             return ExtensionManager.this;
         }
 
-        public Enumeration getEntries()
-        {
-            return ExtensionManager.this.getEntries();
-        }
-
         public URL getEntry(String name)
         {
             // There is no content for the system bundle, so return null.
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 06736f5..bad7983 100644
--- a/framework/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
+++ b/framework/src/main/java/org/apache/felix/framework/FindEntriesEnumeration.java
@@ -20,10 +20,14 @@
 
 import java.util.*;
 
+import org.apache.felix.moduleloader.IModule;
+
 class FindEntriesEnumeration implements Enumeration
 {
     private BundleImpl m_bundle = null;
-    private Enumeration m_enumeration = null;
+    private Enumeration[] m_enumerations = null;
+    private IModule[] m_modules = null;
+    private int m_moduleIndex = 0;
     private String m_path = null;
     private String[] m_filePattern = null;
     private boolean m_recurse = false;
@@ -34,8 +38,24 @@
     {
         m_bundle = bundle;
         m_path = path;
-        m_enumeration = (m_bundle.getCurrentModule().getContent() == null)
-            ? null : ((ModuleImpl) m_bundle.getCurrentModule()).getEntries();
+        IModule bundleModule = m_bundle.getCurrentModule();
+        IModule[] fragmentModules = ((ModuleImpl) bundleModule).getFragments();
+        if (fragmentModules == null)
+        {
+            fragmentModules = new IModule[0];
+        }
+        m_modules = new IModule[fragmentModules.length + 1];
+        m_modules[0] = bundleModule;
+        for (int i = 0; i < fragmentModules.length; i++)
+        {
+            m_modules[i + 1] = fragmentModules[i];
+        }
+        m_enumerations = new Enumeration[m_modules.length];
+        for (int i = 0; i < m_modules.length; i++)
+        {
+            m_enumerations[i] = m_modules[i].getContent() != null ?
+                m_modules[i].getContent().getEntries() : null;
+        }
         m_recurse = recurse;
 
         // Sanity check the parameters.
@@ -84,39 +104,48 @@
         // 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 != null) && m_enumeration.hasMoreElements())
+        if (m_enumerations == null)
         {
-            // Get the next entry name.
-            String entryName = (String) m_enumeration.nextElement();
-            // Check to see if it is a descendent of the specified path.
-            if (!entryName.equals(m_path) && entryName.startsWith(m_path))
+            return null;
+        }
+        while (m_moduleIndex < m_enumerations.length)
+        {
+            while (m_enumerations[m_moduleIndex] != null
+                &&  m_enumerations[m_moduleIndex].hasMoreElements())
             {
-                // If this is recursive search, then try to match any
-                // entry path that starts with the specified path;
-                // otherwise, only try to match children of the specified
-                // path and not any grandchild. This code uses the knowledge
-                // that content entries corresponding to directories end in '/'.
-                int idx = entryName.indexOf('/', m_path.length());
-                if (m_recurse || (idx < 0) || (idx == (entryName.length() - 1)))
+                // Get the next entry name.
+                String entryName = (String) m_enumerations[m_moduleIndex].nextElement();
+                // Check to see if it is a descendent of the specified path.
+                if (!entryName.equals(m_path) && entryName.startsWith(m_path))
                 {
-                    // Get the last element of the entry path, not including
-                    // the '/' if it is a directory.
-                    int endIdx = (entryName.charAt(entryName.length() - 1) == '/')
-                        ? entryName.length() - 1
-                        : entryName.length();
-                    int startIdx = (entryName.charAt(entryName.length() - 1) == '/')
-                        ? entryName.lastIndexOf('/', endIdx - 1) + 1
-                        : entryName.lastIndexOf('/', endIdx) + 1;
-                    String lastElement = entryName.substring(startIdx, endIdx);
-                    
-                    // See if the file pattern matches the last element of the path.
-                    if (checkSubstring(m_filePattern, lastElement))
+                    // If this is recursive search, then try to match any
+                    // entry path that starts with the specified path;
+                    // otherwise, only try to match children of the specified
+                    // path and not any grandchild. This code uses the knowledge
+                    // that content entries corresponding to directories end in '/'.
+                    int idx = entryName.indexOf('/', m_path.length());
+                    if (m_recurse || (idx < 0) || (idx == (entryName.length() - 1)))
                     {
-                        // Convert entry name into an entry URL.
-                        return m_bundle.getCurrentModule().getEntry(entryName);
+                        // Get the last element of the entry path, not including
+                        // the '/' if it is a directory.
+                        int endIdx = (entryName.charAt(entryName.length() - 1) == '/')
+                            ? entryName.length() - 1
+                            : entryName.length();
+                        int startIdx = (entryName.charAt(entryName.length() - 1) == '/')
+                            ? entryName.lastIndexOf('/', endIdx - 1) + 1
+                            : entryName.lastIndexOf('/', endIdx) + 1;
+                        String lastElement = entryName.substring(startIdx, endIdx);
+                        
+                        // See if the file pattern matches the last element of the path.
+                        if (checkSubstring(m_filePattern, lastElement))
+                        {
+                            // Convert entry name into an entry URL.
+                            return m_modules[m_moduleIndex].getEntry(entryName);
+                        }
                     }
                 }
             }
+            m_moduleIndex++;
         }
 
         return null;
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 bb20bb3..f796cbc 100644
--- a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
@@ -428,20 +428,6 @@
         return m_content;
     }
 
-    synchronized Enumeration getEntries()
-    {
-        Enumeration[] ens =
-            new Enumeration[(m_fragmentContents == null)
-                ? 1
-                : m_fragmentContents.length + 1];
-        ens[0] = m_content.getEntries();
-        for (int i = 1; i < ens.length; i++)
-        {
-            ens[i] = m_fragmentContents[i - 1].getEntries();
-        }
-        return new CompoundEnumeration(ens);
-    }
-
     private synchronized IContent[] getContentPath()
     {
         if (m_contentPath == null)
