Author: markt
Date: Mon Jan 20 14:22:49 2014
New Revision: 1559707
URL: http://svn.apache.org/r1559707
Log:
Additional fix for bug 56029. Now whitespace is not skipped, make sure it is
trimmed before the function name is used.
Includes a test case based on a jspx file by kkolinko.
Added:
tomcat/trunk/test/webapp/bug5nnnn/bug56029.jspx
Modified:
tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java
tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
tomcat/trunk/test/org/apache/el/TestELInJsp.java
Modified: tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java?rev=1559707&r1=1559706&r2=1559707&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java Mon Jan 20
14:22:49 2014
@@ -161,7 +161,7 @@ public class ELParser {
}
}
if (curToken.toChar() == '(') {
- ELexpr.add(new ELNode.Function(s1, s2));
+ ELexpr.add(new ELNode.Function(s1.trim(), s2.trim()));
return true;
}
curToken = original;
Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1559707&r1=1559706&r2=1559707&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Mon
Jan 20 14:22:49 2014
@@ -330,7 +330,7 @@ jsp.error.tagfile.badSuffix=Missing \".t
jsp.error.tagfile.illegalPath=Illegal tag file path: {0}, must start with
\"/WEB-INF/tags\" or \"/META-INF/tags\"
jsp.error.tagfile.missingPath=Path not specified to tag file
jsp.error.plugin.wrongRootElement=Name of root element in {0} different from
{1}
-jsp.error.attribute.invalidPrefix=The attribute prefix {0} does not correspond
to any imported tag library
+jsp.error.attribute.invalidPrefix=The attribute prefix [{0}] does not
correspond to any imported tag library
jsp.error.nested.jspattribute=A jsp:attribute standard action cannot be nested
within another jsp:attribute standard action
jsp.error.nested.jspbody=A jsp:body standard action cannot be nested within
another jsp:body or jsp:attribute standard action
jsp.error.variable.either.name=Either name-given or name-from-attribute
attribute must be specified in a variable directive
Modified: tomcat/trunk/test/org/apache/el/TestELInJsp.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestELInJsp.java?rev=1559707&r1=1559706&r2=1559707&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestELInJsp.java (original)
+++ tomcat/trunk/test/org/apache/el/TestELInJsp.java Mon Jan 20 14:22:49 2014
@@ -21,10 +21,14 @@ import java.io.File;
import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
import org.junit.Test;
+import org.apache.catalina.Context;
+import org.apache.catalina.WebResourceRoot;
import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.webresources.StandardRoot;
import org.apache.tomcat.util.buf.ByteChunk;
/**
@@ -446,6 +450,32 @@ public class TestELInJsp extends TomcatB
assertEcho(result, "05-Hello JUnit from Tomcat");
}
+ @Test
+ public void testBug56029() throws Exception {
+ Tomcat tomcat = getTomcatInstance();
+
+ File appDir = new File("test/webapp");
+ // app dir is relative to server home
+ Context ctxt = tomcat.addWebapp(null, "/test",
appDir.getAbsolutePath());
+
+ // This test needs the JSTL libraries
+ File lib = new File("webapps/examples/WEB-INF/lib");
+ ctxt.setResources(new StandardRoot(ctxt));
+ ctxt.getResources().createWebResourceSet(
+ WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib",
+ lib.getAbsolutePath(), null, "/");
+
+ tomcat.start();
+
+ ByteChunk res = getUrl("http://localhost:" + getPort() +
+ "/test/bug5nnnn/bug56029.jspx");
+
+ String result = res.toString();
+
+ Assert.assertTrue(result.contains("[1]"));
+ }
+
+
// Assertion for text contained with <p></p>, e.g. printed by tags:echo
private static void assertEcho(String result, String expected) {
assertTrue(result.indexOf("<p>" + expected + "</p>") > 0);
Added: tomcat/trunk/test/webapp/bug5nnnn/bug56029.jspx
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug5nnnn/bug56029.jspx?rev=1559707&view=auto
==============================================================================
--- tomcat/trunk/test/webapp/bug5nnnn/bug56029.jspx (added)
+++ tomcat/trunk/test/webapp/bug5nnnn/bug56029.jspx Mon Jan 20 14:22:49 2014
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions">
+ <jsp:directive.page contentType="text/html; charset=UTF-8" session="false" />
+ <c:set var="list" value="%=new java.util.ArrayList() %" />
+ <c:set var="limit" value="${1 + fn:length(list)}" />
+ [${limit}]
+</jsp:root>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]