Author: markt
Date: Wed Aug 24 11:27:29 2016
New Revision: 1757495

URL: http://svn.apache.org/viewvc?rev=1757495&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60032
Fix handling of method calls that use varargs within EL value expressions.

Added:
    tomcat/trunk/test/webapp/bug6nnnn/
    tomcat/trunk/test/webapp/bug6nnnn/bug60032.jsp   (with props)
Modified:
    tomcat/trunk/java/org/apache/el/parser/AstFunction.java
    tomcat/trunk/test/org/apache/el/TestELInJsp.java
    tomcat/trunk/test/org/apache/el/TesterFunctions.java
    tomcat/trunk/test/webapp/WEB-INF/test.tld
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstFunction.java?rev=1757495&r1=1757494&r2=1757495&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/parser/AstFunction.java (original)
+++ tomcat/trunk/java/org/apache/el/parser/AstFunction.java Wed Aug 24 11:27:29 
2016
@@ -178,6 +178,8 @@ public final class AstFunction extends S
                                 varargs[j-i] = 
parameters.jjtGetChild(j).getValue(ctx);
                                 varargs[j-i] = coerceToType(ctx, varargs[j-i], 
target);
                             }
+                            params[i] = varargs;
+                            params[i] = coerceToType(ctx, params[i], 
paramTypes[i]);
                         }
                     } else {
                         params[i] = parameters.jjtGetChild(i).getValue(ctx);

Modified: tomcat/trunk/test/org/apache/el/TestELInJsp.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestELInJsp.java?rev=1757495&r1=1757494&r2=1757495&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestELInJsp.java (original)
+++ tomcat/trunk/test/org/apache/el/TestELInJsp.java Wed Aug 24 11:27:29 2016
@@ -489,6 +489,16 @@ public class TestELInJsp extends TomcatB
     }
 
 
+    @Test
+    public void testBug60032() throws Exception {
+        getTomcatInstanceTestWebapp(false, true);
+
+        ByteChunk res = getUrl("http://localhost:"; + getPort() + 
"/test/bug6nnnn/bug60032.jsp");
+        String result = res.toString();
+        assertEcho(result, "{OK}");
+    }
+
+
     // Assertion for text contained with <p></p>, e.g. printed by tags:echo
     private static void assertEcho(String result, String expected) {
         Assert.assertTrue(result, result.indexOf("<p>" + expected + "</p>") > 
0);

Modified: tomcat/trunk/test/org/apache/el/TesterFunctions.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TesterFunctions.java?rev=1757495&r1=1757494&r2=1757495&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TesterFunctions.java (original)
+++ tomcat/trunk/test/org/apache/el/TesterFunctions.java Wed Aug 24 11:27:29 
2016
@@ -22,6 +22,18 @@ public class TesterFunctions {
         return input.trim();
     }
 
+    public static String concat(String... inputs) {
+        if (inputs == null || inputs.length == 0) {
+            return null;
+        }
+        StringBuilder result = new StringBuilder();
+        for (String input : inputs) {
+            result.append(input);
+        }
+        return result.toString();
+    }
+
+
     public static class Inner$Class {
 
         public static final String RETVAL = "Return from bug49555";

Modified: tomcat/trunk/test/webapp/WEB-INF/test.tld
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/WEB-INF/test.tld?rev=1757495&r1=1757494&r2=1757495&view=diff
==============================================================================
--- tomcat/trunk/test/webapp/WEB-INF/test.tld (original)
+++ tomcat/trunk/test/webapp/WEB-INF/test.tld Wed Aug 24 11:27:29 2016
@@ -31,4 +31,13 @@
       java.lang.String trim(java.lang.String)
     </function-signature>
   </function>
+  
+  <function>
+    <name>concat</name>
+    <function-class>org.apache.el.TesterFunctions</function-class>
+    <function-signature>
+      java.lang.String concat(java.lang.String[])
+    </function-signature>
+  </function>
+  
 </taglib>
\ No newline at end of file

Added: tomcat/trunk/test/webapp/bug6nnnn/bug60032.jsp
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug6nnnn/bug60032.jsp?rev=1757495&view=auto
==============================================================================
--- tomcat/trunk/test/webapp/bug6nnnn/bug60032.jsp (added)
+++ tomcat/trunk/test/webapp/bug6nnnn/bug60032.jsp Wed Aug 24 11:27:29 2016
@@ -0,0 +1,24 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib uri="http://tomcat.apache.org/testerFunctions"; prefix="fn" %>
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+<html>
+  <head><title>Bug 60032 test case</title></head>
+  <body>
+    <tags:echo echo="${fn:concat('{', 'O', 'K', '}')}"/>
+  </body>
+</html>
\ No newline at end of file

Propchange: tomcat/trunk/test/webapp/bug6nnnn/bug60032.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1757495&r1=1757494&r2=1757495&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Aug 24 11:27:29 2016
@@ -221,6 +221,10 @@
         Improve the error handling for custom tags to ensure that the tag is
         returned to the pool or released and destroyed once used. (markt)
       </fix>
+      <fix>
+        <bug>60032</bug>: Fix handling of method calls that use varargs within
+        EL value expressions. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">



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

Reply via email to