Author: kkolinko
Date: Sat Mar 6 21:03:14 2010
New Revision: 919851
URL: http://svn.apache.org/viewvc?rev=919851&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48668
Honor isELIgnored and isDeferredSyntaxAllowed in the Parser
Uncommented the test cases in TestParser/bug48668a.jsp that now are passing.
The ##12,13,16,17 remain commented, because they are still failing.
Modified:
tomcat/trunk/java/org/apache/jasper/compiler/Parser.java
tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java
tomcat/trunk/test/webapp/bug48668a.jsp
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Parser.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Parser.java?rev=919851&r1=919850&r2=919851&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Parser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Parser.java Sat Mar 6
21:03:14 2010
@@ -1462,9 +1462,11 @@
err.jspError(reader.mark(), "jsp.error.no.scriptlets");
} else if (reader.matches("<jsp:text")) {
parseXMLTemplateText(parent);
- } else if (reader.matches("${")) {
+ } else if (!pageInfo.isELIgnored() && reader.matches("${")) {
parseELExpression(parent, '$');
- } else if (reader.matches("#{")) {
+ } else if (!pageInfo.isELIgnored()
+ && !pageInfo.isDeferredSyntaxAllowedAsLiteral()
+ && reader.matches("#{")) {
parseELExpression(parent, '#');
} else if (reader.matches("<jsp:")) {
parseStandardAction(parent);
@@ -1513,10 +1515,12 @@
} else if (reader.matches("<jsp:text")) {
err.jspError(reader.mark(), "jsp.error.not.in.template",
"<jsp:text");
- } else if (reader.matches("${")) {
+ } else if (!pageInfo.isELIgnored() && reader.matches("${")) {
err.jspError(reader.mark(), "jsp.error.not.in.template",
"Expression language");
- } else if (reader.matches("#{")) {
+ } else if (!pageInfo.isELIgnored()
+ && !pageInfo.isDeferredSyntaxAllowedAsLiteral()
+ && reader.matches("#{")) {
err.jspError(reader.mark(), "jsp.error.not.in.template",
"Expression language");
} else if (reader.matches("<jsp:")) {
Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java?rev=919851&r1=919850&r2=919851&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java (original)
+++ tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java Sat Mar 6
21:03:14 2010
@@ -78,17 +78,17 @@
assertEcho(result, "32-Hello #{'foo}");
assertEcho(result, "33-Hello #{'foo}");
assertEcho(result, "34-Hello ${'foo}");
- //assertEcho(result, "35-Hello ${'foo}");
+ assertEcho(result, "35-Hello ${'foo}");
assertEcho(result, "36-Hello #{'foo}");
- //assertEcho(result, "37-Hello #{'foo}");
+ assertEcho(result, "37-Hello #{'foo}");
assertEcho(result, "40-Hello ${'foo}");
- //assertEcho(result, "41-Hello ${'foo}");
- //assertEcho(result, "42-Hello #{'foo}");
- //assertEcho(result, "43-Hello #{'foo}");
+ assertEcho(result, "41-Hello ${'foo}");
+ assertEcho(result, "42-Hello #{'foo}");
+ assertEcho(result, "43-Hello #{'foo}");
assertEcho(result, "50-Hello ${'foo}");
- //assertEcho(result, "51-Hello ${'foo}");
- //assertEcho(result, "52-Hello #{'foo}");
- //assertEcho(result, "53-Hello #{'foo}");
+ assertEcho(result, "51-Hello ${'foo}");
+ assertEcho(result, "52-Hello #{'foo}");
+ assertEcho(result, "53-Hello #{'foo}");
}
public void testBug48668b() throws Exception {
Modified: tomcat/trunk/test/webapp/bug48668a.jsp
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/bug48668a.jsp?rev=919851&r1=919850&r2=919851&view=diff
==============================================================================
--- tomcat/trunk/test/webapp/bug48668a.jsp (original)
+++ tomcat/trunk/test/webapp/bug48668a.jsp Sat Mar 6 21:03:14 2010
@@ -42,19 +42,19 @@
<p>32-<tags:bug48668 noexpr="Hello #{'foo}"/></p>
<p>33-Hello <tags:bug48668 noexpr="#{'foo}"/></p>
<p>34-<tags:bug48668><jsp:attribute name="noexpr">Hello
${'foo}</jsp:attribute></tags:bug48668></p>
-<%--<p>35-Hello <tags:bug48668><jsp:attribute
name="noexpr">${'foo}</jsp:attribute></tags:bug48668></p>--%>
+ <p>35-Hello <tags:bug48668><jsp:attribute
name="noexpr">${'foo}</jsp:attribute></tags:bug48668></p>
<p>36-<tags:bug48668><jsp:attribute name="noexpr">Hello
#{'foo}</jsp:attribute></tags:bug48668></p>
-<%--<p>37-Hello <tags:bug48668><jsp:attribute
name="noexpr">#{'foo}</jsp:attribute></tags:bug48668></p>--%>
+ <p>37-Hello <tags:bug48668><jsp:attribute
name="noexpr">#{'foo}</jsp:attribute></tags:bug48668></p>
<p>40-<tags:bug48668><jsp:attribute name="fragment">Hello
${'foo}</jsp:attribute></tags:bug48668></p>
<p>41-Hello <tags:bug48668><jsp:attribute
name="fragment">${'foo}</jsp:attribute></tags:bug48668></p>
<p>42-<tags:bug48668><jsp:attribute name="fragment">Hello
#{'foo}</jsp:attribute></tags:bug48668></p>
-<%--<p>43-Hello <tags:bug48668><jsp:attribute
name="fragment">#{'foo}</jsp:attribute></tags:bug48668></p>--%>
+ <p>43-Hello <tags:bug48668><jsp:attribute
name="fragment">#{'foo}</jsp:attribute></tags:bug48668></p>
<p>50-<tags:bug48668>Hello ${'foo}</tags:bug48668></p>
<p>51-Hello <tags:bug48668>${'foo}</tags:bug48668></p>
<p>52-<tags:bug48668>Hello #{'foo}</tags:bug48668></p>
-<%--<p>53-Hello <tags:bug48668>#{'foo}</tags:bug48668></p>--%>
+ <p>53-Hello <tags:bug48668>#{'foo}</tags:bug48668></p>
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]