Author: remy.maucherat(a)jboss.com
Date: 2012-01-05 11:10:52 -0500 (Thu, 05 Jan 2012)
New Revision: 1913
Modified:
trunk/java/org/apache/el/util/ReflectionUtil.java
trunk/test/java/org/apache/el/TestMethodExpressionImpl.java
trunk/webapps/docs/changelog.xml
Log:
AS7-3177: NPE mapping null parameters values in EL
Modified: trunk/java/org/apache/el/util/ReflectionUtil.java
===================================================================
--- trunk/java/org/apache/el/util/ReflectionUtil.java 2012-01-04 16:14:28 UTC (rev 1912)
+++ trunk/java/org/apache/el/util/ReflectionUtil.java 2012-01-05 16:10:52 UTC (rev 1913)
@@ -156,8 +156,7 @@
int exactMatch = 0;
boolean noMatch = false;
for (int i = 0; i < mParamCount; i++) {
- // Can't be null
- if (mParamTypes[i].equals(paramTypes[i])) {
+ if (paramTypes[i] == null || mParamTypes[i].equals(paramTypes[i])) {
exactMatch++;
} else if (i == (mParamCount - 1) && m.isVarArgs()) {
Class<?> varType = mParamTypes[i].getComponentType();
Modified: trunk/test/java/org/apache/el/TestMethodExpressionImpl.java
===================================================================
--- trunk/test/java/org/apache/el/TestMethodExpressionImpl.java 2012-01-04 16:14:28 UTC
(rev 1912)
+++ trunk/test/java/org/apache/el/TestMethodExpressionImpl.java 2012-01-05 16:10:52 UTC
(rev 1913)
@@ -156,6 +156,20 @@
}
@Test
+ public void testInvokeAS7_3177() {
+ TesterBeanB beanB = new TesterBeanB();
+ beanB.setName("B");
+
+ context.getVariableMapper().setVariable("arg",
+ factory.createValueExpression(null, Object.class));
+
+ MethodExpression me1 = factory.createMethodExpression(
+ context, "${beanB.sayHello(arg)}", String.class,
+ null);
+ assertEquals("Hello null from B", me1.invoke(context, null));
+ }
+
+ @Test
public void testInvokeWithSuper() {
MethodExpression me = factory.createMethodExpression(context,
"${beanA.setBean(beanBB)}", null ,
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2012-01-04 16:14:28 UTC (rev 1912)
+++ trunk/webapps/docs/changelog.xml 2012-01-05 16:10:52 UTC (rev 1913)
@@ -24,6 +24,16 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <jira>211</jira>: Better exception handling when validating EL.
(remm)
+ </fix>
+ <fix>
+ <jboss-jira>AS7-3177</jboss-jira>: NPE mapping null parameters
values in EL. (remm)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="JBoss Web 7.0.7.Final (remm)">
Show replies by date