Make sure we return null for PackageAdmin.getBundle(Class) when
the bundle is from a different framework. (FELIX-1292)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@790324 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 097e13b..44ce43e 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3055,9 +3055,11 @@
     {
         if (clazz.getClassLoader() instanceof ModuleClassLoader)
         {
-            IModule module =
+            // Only return the bundle if it is from this framework.
+            ModuleImpl module = (ModuleImpl)
                 ((ModuleClassLoader) clazz.getClassLoader()).getModule();
-            return module.getBundle();
+            return (((BundleImpl) module.getBundle()).getFramework() == this)
+                ? module.getBundle() : null;
         }
         try
         {