From 8d622b4b36f0c4ebb32cee344da9fa057d05f857 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 31 May 2010 18:39:55 +0000 Subject: [PATCH] Fix EL issue reported on users list by obtaining class information directly from the values rather than via getType() which is likely to return a more generic type that the actual type of the value. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@949829 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/el/parser/AstValue.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/java/org/apache/el/parser/AstValue.java b/java/org/apache/el/parser/AstValue.java index 94293cd48..fedf6d187 100644 --- a/java/org/apache/el/parser/AstValue.java +++ b/java/org/apache/el/parser/AstValue.java @@ -244,10 +244,9 @@ public final class AstValue extends SimpleNode { Method m = null; Object[] values = null; if (isParametersProvided()) { - Class[] types = ((AstMethodParameters) - this.jjtGetChild(2)).getParameterTypes(ctx); values = ((AstMethodParameters) this.jjtGetChild(2)).getParameters(ctx); + Class[] types = getTypesFromValues(values); m = ReflectionUtil.getMethod(t.base, t.property, types); } else { m = ReflectionUtil.getMethod(t.base, t.property, paramTypes); @@ -266,6 +265,23 @@ public final class AstValue extends SimpleNode { return result; } + private Class[] getTypesFromValues(Object[] values) { + if (values == null) { + return null; + } + + Class result[] = new Class[values.length]; + for (int i = 0; i < values.length; i++) { + if (values[i] == null) { + result[i] = null; + } else { + result[i] = values[i].getClass(); + } + } + return result; + } + + /** * @since EL 2.2 */ -- 2.11.0