Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Correctly handle the error when fewer parameter values than required by the method are used to invoke an EL method expression.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1788323 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Mar 23, 2017
1 parent bc8db4d commit 11af805
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/org/apache/el/util/ReflectionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static Method getMethod(EvaluationContext ctx, Object base, Object proper
if (isAssignableFrom(paramTypes[j], varType)) {
assignableMatch++;
} else {
if (paramValues == null) {
if (paramValues == null || j >= paramValues.length) {
noMatch = true;
break;
} else {
Expand All @@ -203,7 +203,7 @@ public static Method getMethod(EvaluationContext ctx, Object base, Object proper
} else if (isAssignableFrom(paramTypes[i], mParamTypes[i])) {
assignableMatch++;
} else {
if (paramValues == null) {
if (paramValues == null || i >= paramValues.length) {
noMatch = true;
break;
} else {
Expand Down
7 changes: 7 additions & 0 deletions test/org/apache/el/TestMethodExpressionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,11 @@ public void testBug57855e() {
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() });
}
}
9 changes: 9 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 11af805

Please sign in to comment.