Followup to r1173630
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 21 Sep 2011 15:35:47 +0000 (15:35 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 21 Sep 2011 15:35:47 +0000 (15:35 +0000)
Simplify code: methodName can be tested once per iteration

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1173722 13f79535-47bb-0310-9956-ffa450edef68

java/javax/el/BeanELResolver.java

index dca216f..307ba62 100644 (file)
@@ -414,15 +414,16 @@ public class BeanELResolver extends ELResolver {
             }
             Method[] methods = clazz.getMethods();
             for (Method m : methods) {
-                if (methodName.equals(m.getName()) && 
-                        m.getParameterTypes().length == paramCount) {
-                    // Same number of parameters - use the first match
-                    matchingMethod = getMethod(clazz, m);
-                    break;
-                }
-                if (m.isVarArgs() && methodName.equals(m.getName()) && 
-                            paramCount > m.getParameterTypes().length - 2 ) {
-                    matchingMethod = getMethod(clazz, m);
+                if (methodName.equals(m.getName())) {
+                    if (m.getParameterTypes().length == paramCount) {
+                        // Same number of parameters - use the first match
+                        matchingMethod = getMethod(clazz, m);
+                        break;
+                    }
+                    if (m.isVarArgs()
+                            && paramCount > m.getParameterTypes().length - 2) {
+                        matchingMethod = getMethod(clazz, m);
+                    }
                 }
             }
             if (matchingMethod == null) {