Use a new method on pd to check for allowed exports.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@633838 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
index f727f6d..cba96f6 100755
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
@@ -31,6 +31,7 @@
 import java.util.Map;
 import java.util.StringTokenizer;
 
+import org.apache.felix.framework.BundleProtectionDomain;
 import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.util.CompoundEnumeration;
 import org.apache.felix.framework.util.SecurityManagerEx;
@@ -863,7 +864,7 @@
                     {
 // TODO: RB - Is this permission check correct.
                         if ((System.getSecurityManager() != null) &&
-                            !((ProtectionDomain) modules[modIdx].getContentLoader().getSecurityContext()).implies(
+                            !((BundleProtectionDomain) modules[modIdx].getContentLoader().getSecurityContext()).impliesDirect(
                                 new PackagePermission(pkgName,
                                     PackagePermission.EXPORT)))
                         {
@@ -898,7 +899,7 @@
 // TODO: RB - Is this permission check correct.
                             if (inUseCaps[capIdx].getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
                                 (System.getSecurityManager() != null) &&
-                                !((ProtectionDomain) module.getContentLoader().getSecurityContext()).implies(
+                                !((BundleProtectionDomain) module.getContentLoader().getSecurityContext()).impliesDirect(
                                     new PackagePermission(
                                         (String) inUseCaps[capIdx].getProperties().get(ICapability.PACKAGE_PROPERTY),
                                         PackagePermission.EXPORT)))