Skip to content

Commit

Permalink
Fix a regression in the TLD whitespace parsing fix that broke parsing…
Browse files Browse the repository at this point in the history
… when whitespace was present between the method name and the opening '(' of the parameters.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1841757 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Sep 23, 2018
1 parent 9e7e68f commit a0ec446
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion java/org/apache/jasper/compiler/Validator.java
Expand Up @@ -423,7 +423,7 @@ private void compareTagEncodings(String thePageDirEnc,
private static class ValidateVisitor extends Node.Visitor {

// Pattern to extract a method name from a full method signature
private static final Pattern METHOD_NAME_PATTERN = Pattern.compile(".*[ \t\n\r]+(.+)[ \t\n\r]*\\(.*");
private static final Pattern METHOD_NAME_PATTERN = Pattern.compile(".*[ \t\n\r]+(.+?)[ \t\n\r]*\\(.*");

private final PageInfo pageInfo;

Expand Down
1 change: 1 addition & 0 deletions test/org/apache/el/TestELInJsp.java
Expand Up @@ -507,6 +507,7 @@ public void testBug60431() throws Exception {
String result = res.toString();
assertEcho(result, "01-OK");
assertEcho(result, "02-OK");
assertEcho(result, "03-OK");
}


Expand Down
10 changes: 10 additions & 0 deletions test/webapp/WEB-INF/test.tld
Expand Up @@ -48,4 +48,14 @@
</function-signature>
</function>

<function>
<name>toArrayB</name>
<function-class>org.apache.el.TesterFunctions</function-class>
<!-- Do not change whitespace in signature below.
It used to test for correctness in o.a.jasper.compiler.Validator. -->
<function-signature>
java.lang.String toArray (java.lang.String,java.lang.String)
</function-signature>
</function>

</taglib>
1 change: 1 addition & 0 deletions test/webapp/bug6nnnn/bug60431.jsp
Expand Up @@ -21,5 +21,6 @@
<body>
<tags:echo echo="${'01-' += fn:concat('O', 'K')}"/>
<tags:echo echo="${'02-' += fn:concat(fn:toArray('O', 'K'))}"/>
<tags:echo echo="${'03-' += fn:concat(fn:toArrayB('O', 'K'))}"/>
</body>
</html>

0 comments on commit a0ec446

Please sign in to comment.