Author: markt
Date: Thu Mar 23 21:05:09 2017
New Revision: 1788323

URL: http://svn.apache.org/viewvc?rev=1788323&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60844
Correctly handle the error when fewer parameter values than required by the 
method are used to invoke an EL method expression.

Modified:
    tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java
    tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java?rev=1788323&r1=1788322&r2=1788323&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java (original)
+++ tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java Thu Mar 23 
21:05:09 2017
@@ -184,7 +184,7 @@ public class ReflectionUtil {
                         if (isAssignableFrom(paramTypes[j], varType)) {
                             assignableMatch++;
                         } else {
-                            if (paramValues == null) {
+                            if (paramValues == null || j >= 
paramValues.length) {
                                 noMatch = true;
                                 break;
                             } else {
@@ -203,7 +203,7 @@ public class ReflectionUtil {
                 } else if (isAssignableFrom(paramTypes[i], mParamTypes[i])) {
                     assignableMatch++;
                 } else {
-                    if (paramValues == null) {
+                    if (paramValues == null || i >= paramValues.length) {
                         noMatch = true;
                         break;
                     } else {

Modified: tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java?rev=1788323&r1=1788322&r2=1788323&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java (original)
+++ tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java Thu Mar 23 
21:05:09 2017
@@ -531,4 +531,11 @@ public class TestMethodExpressionImpl {
         assertEquals("aaa, bbb", r.toString());
     }
 
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testBug60844() {
+        MethodExpression me2 = factory.createMethodExpression(context,
+                "${beanC.sayHello}", null , new Class[]{ TesterBeanA.class, 
TesterBeanB.class});
+        me2.invoke(context, new Object[] { new Object() });
+    }
 }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1788323&r1=1788322&r2=1788323&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Mar 23 21:05:09 2017
@@ -130,6 +130,15 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>60844</bug>: Correctly handle the error when fewer parameter 
values
+        than required by the method are used to invoke an EL method expression.
+        (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="jdbc-pool">
     <changelog>
       <fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to