Per spec a call to PackageAdmin.getBundle(Class) should return the Bundle that has the classloader that loaded this class. We only return the bundle if it is a real one (i.e., not the system bundle). This returns the system bundle in case the class comes from the classloader (or one of its parents) that loaded Felix and the system bundle exports the package.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@575471 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 6421995..a789abf 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -2839,7 +2839,7 @@
}
}
}
- return null;
+ return (getInfo().getCurrentModule().getClass(clazz.getName()) == clazz) ? this : null;
}
/**