Author: dblevins
Date: Tue Mar 29 22:10:35 2011
New Revision: 1086782

URL: http://svn.apache.org/viewvc?rev=1086782&view=rev
Log:
Fix invalid callback detection to print expected arguments

Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java?rev=1086782&r1=1086781&r2=1086782&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
 Tue Mar 29 22:10:35 2011
@@ -349,10 +349,10 @@ public class CheckCallbacks extends Vali
 
             if (possibleMethods.size() == 0) {
                 fail(bean, "callback.missing", type, callback.getMethodName(), 
callback.getClassName());
-            } else if (possibleMethods.size() != parameterTypes.length) {
-                fail(bean, "callback.invalidArguments", type, 
callback.getMethodName(), getParameters(possibleMethods.get(0)), 
callback.getClassName());
+            } else if (possibleMethods.size() == 1) {
+                fail(bean, "callback.invalidArguments", type, 
callback.getMethodName(), getParameters(possibleMethods.get(0)), 
callback.getClassName(), getParameters(parameterTypes));
             } else {
-                fail(bean, "callback.missing.possibleTypo", type, 
callback.getMethodName(), possibleMethods.size(), callback.getClassName());
+                fail(bean, "callback.missing.possibleTypo", type, 
callback.getMethodName(), possibleMethods.size(), callback.getClassName(), 
getParameters(parameterTypes));
             }
         }
     }

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties?rev=1086782&r1=1086781&r2=1086782&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
 Tue Mar 29 22:10:35 2011
@@ -206,13 +206,13 @@
 
 # fail(bean, "callback.invalidArguments", type, callback.getMethodName(), 
getParameters(possibleMethods.get(0)), callback.getClassName());
 1.callback.invalidArguments = Invalid {0} arguments
-2.callback.invalidArguments = Invalid {0} arguments: {1}({2})
-3.callback.invalidArguments = {0} method signature "{1}({2})" in class {3} has 
invalid arguments.  The required method signature is "void {1}()"
+2.callback.invalidArguments = Invalid {0} arguments. Found: {1}({2}). 
Required: {1}({4}) 
+3.callback.invalidArguments = {0} method signature "{1}({2})" in class {3} has 
invalid arguments.  The required method signature is "void {1}(4)"
 
 # fail(bean, "callback.missing.possibleTypo", type, callback.getMethodName(), 
possibleMethods.size(), callback.getClassName());
 1.callback.missing.possibleTypo = {0} method missing or invalid
-2.callback.missing.possibleTypo = {0} method missing or invalid: looked for 
"void {1}()" in class {3}
-3.callback.missing.possibleTypo = {0} method missing or invalid.  There are 
{2} methods with the name "{1}" visible in class {3}, none have the required 
signature of "void {1}()"
+2.callback.missing.possibleTypo = {0} method missing or invalid: looked for 
"void {1}({4})" in class {3}
+3.callback.missing.possibleTypo = {0} method missing or invalid.  There are 
{2} methods with the name "{1}" visible in class {3}, none have the required 
signature of "void {1}(4)"
 
 # fail(bean, "callback.sessionSynchronization.invalidUse", class)
 1.callback.sessionSynchronization.invalidUse = Session synchronization 
annotations and configurations in deployment plan should not be used while 
SessionSynchronization interface is implemented by the bean class.


Reply via email to