tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r644134 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
Date Thu, 03 Apr 2008 01:59:36 GMT
Author: dblevins
Date: Wed Apr  2 18:59:35 2008
New Revision: 644134

URL: http://svn.apache.org/viewvc?rev=644134&view=rev
Log:
check for callback methods in parent classes as well

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java?rev=644134&r1=644133&r2=644134&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
Wed Apr  2 18:59:35 2008
@@ -321,7 +321,6 @@
     }
 
     private Method toMethod(Class clazz, NamedMethodInfo info) {
-        Method method = null;
         List<Class> parameterTypes = new ArrayList<Class>();
 
         if (info.methodParams != null){
@@ -334,12 +333,21 @@
             }
         }
 
-        try {
-            method = clazz.getDeclaredMethod(info.methodName, parameterTypes.toArray(new
Class[parameterTypes.size()]));
-        } catch (NoSuchMethodException e) {
-            throw new IllegalStateException("Callback method does not exist: " + clazz.getName()
+ "." + info.methodName, e);
+        Class[] parameters = parameterTypes.toArray(new Class[parameterTypes.size()]);
+
+        IllegalStateException noSuchMethod = null;
+        while (clazz != null) {
+            try {
+                return clazz.getDeclaredMethod(info.methodName, parameters);
+            } catch (NoSuchMethodException e) {
+                if (noSuchMethod == null) {
+                    noSuchMethod = new IllegalStateException("Callback method does not exist:
" + clazz.getName() + "." + info.methodName, e);
+                }
+                clazz = clazz.getSuperclass();
+            }
         }
-        return method;
+
+        throw noSuchMethod;
     }
 
 



Mime
View raw message