Author: cziegeler
Date: Mon Aug 25 02:30:31 2008
New Revision: 688679

URL: http://svn.apache.org/viewvc?rev=688679&view=rev
Log:
FELIX-694 : Use the class which declares the bind/unmind method to load the 
service class.

Modified:
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java?rev=688679&r1=688678&r2=688679&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java 
(original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/DependencyManager.java 
Mon Aug 25 02:30:31 2008
@@ -709,7 +709,7 @@
      * @throws InvocationTargetException If an unexpected error occurrs trying
      *      to get the method from the targetClass.
      */
-    private Method getBindingMethod( String methodname, Class targetClass, 
Bundle serviceBundle, String parameterClassName )
+    private Method getBindingMethod( String methodname, Class targetClass, 
String parameterClassName )
         throws InvocationTargetException
     {
         Class parameterClass = null;
@@ -732,7 +732,7 @@
             try
             {
                 // Case2 - Service object parameter
-                parameterClass = serviceBundle.loadClass(
+                parameterClass = targetClass.getClassLoader().loadClass(
                     parameterClassName );
                 return AbstractComponentManager.getMethod( targetClass, 
methodname, new Class[]
                     { parameterClass }, true );
@@ -784,14 +784,14 @@
             }
             catch ( ClassNotFoundException ex2 )
             {
-                m_componentManager.log( LogService.LOG_ERROR, "Cannot load 
class used as parameter "
-                    + parameterClassName, 
m_componentManager.getComponentMetadata(), ex2 );
+                // if we can't load the class, perhaps the method is declared 
in a super class
+                // so we try this class next
             }
         }
 
         // if we get here, we have no method, so check the super class
         targetClass = targetClass.getSuperclass();
-        return ( targetClass != null ) ? getBindingMethod( methodname, 
targetClass, serviceBundle, parameterClassName ) : null;
+        return ( targetClass != null ) ? getBindingMethod( methodname, 
targetClass, parameterClassName ) : null;
     }
 
 
@@ -826,7 +826,7 @@
                 if ( m_bind == null )
                 {
                     m_bind = getBindingMethod( m_dependencyMetadata.getBind(), 
implementationObject.getClass(),
-                        ref.getBundle(), m_dependencyMetadata.getInterface() );
+                        m_dependencyMetadata.getInterface() );
 
                     // 112.3.1 If the method is not found , SCR must log an 
error
                     // message with the log service, if present, and ignore the
@@ -930,7 +930,7 @@
                 if ( m_unbind == null )
                 {
                     m_unbind = getBindingMethod( 
m_dependencyMetadata.getUnbind(), implementationObject.getClass(),
-                        ref.getBundle(), m_dependencyMetadata.getInterface() );
+                        m_dependencyMetadata.getInterface() );
 
                     if ( m_unbind == null )
                     {


Reply via email to