Project: Tomcat
Bug 48112 Closing curly brace in literal string incorrectly treated as expression terminator.
Reported: 2009-11-03 07:09:58 | Status: resolved fixed

On tomcat 6.0.20 something like the following line in a JSP causes a exception: <c:out value="${fn:trim('{world}')}"/> After removing the closing curly brace from the literal ('{world}' -> '{world') the JSP works. This behaviour seems specific to 6.0.20, as on 6.0.18 and 6.0.16 the line above works fine. Example of exception: ===================== org.apache.jasper.JasperException: An exception occurred processing JSP page /test.jsp at line 11 8: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 9: </head> 10: <body> 11: <c:out value="${fn:trim('{world}')}"/> 12: </body> 13: </html> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.el.ELException: Error Parsing: ${fn:trim('{world} org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:125) org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:150) org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194) org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:934) org.apache.jsp.test_jsp._jspx_meth_c_005fout_005f0(test_jsp.java:98) org.apache.jsp.test_jsp._jspService(test_jsp.java:72) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause org.apache.el.parser.ParseException: Encountered " <ILLEGAL_CHARACTER> "\' "" at line 1, column 11. Was expecting one of: <INTEGER_LITERAL> ... <FLOATING_POINT_LITERAL> ... <STRING_LITERAL> ... "true" ... "false" ... "null" ... "(" ... ")" ... "!" ... "not" ... "empty" ... "-" ... <IDENTIFIER> ... org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142) org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024) org.apache.el.parser.ELParser.Function(ELParser.java:1207) org.apache.el.parser.ELParser.NonLiteral(ELParser.java:1114) org.apache.el.parser.ELParser.ValuePrefix(ELParser.java:1016) org.apache.el.parser.ELParser.Value(ELParser.java:965) org.apache.el.parser.ELParser.Unary(ELParser.java:947) org.apache.el.parser.ELParser.Multiplication(ELParser.java:711) org.apache.el.parser.ELParser.Math(ELParser.java:631) org.apache.el.parser.ELParser.Compare(ELParser.java:443) org.apache.el.parser.ELParser.Equality(ELParser.java:337) org.apache.el.parser.ELParser.And(ELParser.java:281) org.apache.el.parser.ELParser.Or(ELParser.java:225) org.apache.el.parser.ELParser.Choice(ELParser.java:182) org.apache.el.parser.ELParser.Expression(ELParser.java:174) org.apache.el.parser.ELParser.DynamicExpression(ELParser.java:146) org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:43) org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:93) org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:150) org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194) org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:934) org.apache.jsp.test_jsp._jspx_meth_c_005fout_005f0(test_jsp.java:98) org.apache.jsp.test_jsp._jspService(test_jsp.java:72) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Files changed in fix:
test/org/apache/el/TestELEvaluation.java