[jboss-cvs] JBossAS SVN: r67932 - trunk/ejb3/src/main/org/jboss/ejb3.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 5 04:59:44 EST 2007


Author: wolfc
Date: 2007-12-05 04:59:43 -0500 (Wed, 05 Dec 2007)
New Revision: 67932

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
Log:
EJBTHREE-1147: only allowing public methods (4.6.4)

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-12-05 09:31:29 UTC (rev 67931)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java	2007-12-05 09:59:43 UTC (rev 67932)
@@ -942,7 +942,8 @@
             Annotation annotation;
             Class<? extends Annotation> annotationClass;
             // EJB3 4.6.2: The class may implement the ejbCreate method(s).
-            if(hasMethod(ejbClass, "ejbCreate"))
+            // EJB3 4.6.4: The method must be declared as public.
+            if(hasPublicMethod(ejbClass, "ejbCreate"))
             {
                if(isStateful)
                {
@@ -2166,26 +2167,23 @@
    }
 
    /**
-    * Verify whether the class has a method with a certain name.
+    * Verify whether the class has a public method with a certain name.
     * 
     * @param cls            the class to check
     * @param methodName     the method to find
     * @return               true if a method with that name exists on that class
     */
-   private boolean hasMethod(Class<?> cls, String methodName)
+   private boolean hasPublicMethod(Class<?> cls, String methodName)
    {
       assert cls != null : "cls is null";
       assert methodName != null : "methodName is null";
       
-      for(java.lang.reflect.Method m : cls.getDeclaredMethods())
+      for(java.lang.reflect.Method m : cls.getMethods())
       {
          if(m.getName().equals(methodName))
             return true;
       }
       
-      if(cls.getSuperclass() != null)
-         return hasMethod(cls.getSuperclass(), methodName);
-      
       return false;
    }
 




More information about the jboss-cvs-commits mailing list