Fix a NPE when getEntryPaths is called on the system bundle (FELIX-394).
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@587183 13f79535-47bb-0310-9956-ffa450edef68
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 ac3f89e..709f2ae 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -33,6 +33,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Set;
import org.apache.felix.framework.util.FelixConstants;
@@ -78,7 +79,7 @@
// with the parent classloader and one instance per framework instance that
// keeps track of extension bundles and systembundle exports for that framework
// instance.
-class ExtensionManager extends URLStreamHandler implements IModuleDefinition, IContentLoader
+class ExtensionManager extends URLStreamHandler implements IModuleDefinition, IContentLoader, IContent
{
// The private instance that is added to Felix.class.getClassLoader() -
// will be null if extension bundles are not supported (i.e., we are not
@@ -414,7 +415,7 @@
public IContent getContent()
{
- return null;
+ return this;
}
public ISearchPolicy getSearchPolicy()
@@ -573,4 +574,34 @@
m_extensions.add(extension);
}
}
+
+ public Enumeration getEntries()
+ {
+ return new Enumeration()
+ {
+ public boolean hasMoreElements()
+ {
+ return false;
+ }
+
+ public Object nextElement() throws NoSuchElementException
+ {
+ throw new NoSuchElementException();
+ }
+ };
+ }
+
+ public byte[] getEntry(String name)
+ {
+ return null;
+ }
+
+ public InputStream getEntryAsStream(String name) throws IOException
+ {
+ return null;
+ }
+
+ public boolean hasEntry(String name) {
+ return false;
+ }
}