For class accessibility checking we must load directly from the bundle's
module as opposed to Bundle.loadClass() because the spec requires that
that method fire framework events if the class is not found.


git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@425368 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
index 29777d5..7f0cb2e 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
@@ -121,11 +121,13 @@
         {
             // First, try to load the class from the bundle that registered
             // the service.
-            Class targetClass = m_bundle.loadClass(clazz.getName());
+            Class targetClass = ((BundleImpl) m_bundle)
+                .getInfo().getCurrentModule().getClass(clazz.getName());
             if (targetClass != null)
             {
                 return (targetClass == clazz);
             }
+
             // If it cannot be found from the registering bundle, then try to load
             // from the service object or service factory class.
             Class sourceClass = (m_factory != null)
@@ -135,6 +137,7 @@
         }
         catch (Exception ex)
         {
+            // Ignore this and return false.
         }
         return false;
     }