Author: rickhall
Date: Thu Jun 21 07:25:01 2007
New Revision: 549491

URL: http://svn.apache.org/viewvc?view=rev&rev=549491
Log:
Modified isAssignableTo() to check if the provider bundle is the exporter
of the requestor bundle's wire.

Modified:
    
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java

Modified: 
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java?view=diff&rev=549491&r1=549490&r2=549491
==============================================================================
--- 
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
 (original)
+++ 
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
 Thu Jun 21 07:25:01 2007
@@ -150,20 +150,26 @@
         // object uses the same class as the requester.
         else if (providerWire == null)
         {
-            try
+            // If the provider is not the exporter of the requester's package,
+            // then try to use the service registration to see if the 
requester's
+            // class is accessible.
+            if (!((BundleImpl) 
m_bundle).getInfo().hasModule(requesterWire.getExporter()))
             {
-                // Load the class from the requesting bundle.
-                Class requestClass =
-                    ((BundleImpl) 
requester).getInfo().getCurrentModule().getClass(className);
-                // Get the service registration and ask it to check
-                // if the service object is assignable to the requesting
-                // bundle's class.
-                allow = 
getServiceRegistration().isClassAccessible(requestClass);
-            }
-            catch (Exception ex)
-            {
-                // This should not happen, filter to be safe.
-                allow = false;
+                try
+                {
+                    // Load the class from the requesting bundle.
+                    Class requestClass =
+                        ((BundleImpl) 
requester).getInfo().getCurrentModule().getClass(className);
+                    // Get the service registration and ask it to check
+                    // if the service object is assignable to the requesting
+                    // bundle's class.
+                    allow = 
getServiceRegistration().isClassAccessible(requestClass);
+                }
+                catch (Exception ex)
+                {
+                    // This should not happen, filter to be safe.
+                    allow = false;
+                }
             }
         }
         // Case 3: Include service reference if the wires have the


Reply via email to