Bug 58567

Summary: Error compiling EL expression with quotes - attribute not properly terminated.
Product: Tomcat 8 Reporter: Yoni Amir <amir.yoni>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: major    
Priority: P2    
Version: 8.0.27   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Yoni Amir 2015-11-01 09:31:22 UTC
The following page fails to compile in tomcat 8.0.27 and 8.0.28. It works in all prior versions that we ever tried, including earlier versions of 8.x, and also versions of 7.x and 6.x. It is a regression and it breaks many pages in my application.

Here is the JSP text:

<%@ page pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%

	request.setAttribute("myAccountEmail", "test@example.com");

%>
<c:if test="${(myAccountEmail != null) && (myAccountEmail != \"\")}">
	not empty
</c:if>

Note #1: trying to use system property org.apache.jasper.compiler. Parser.STRICT_QUOTE_ESCAPING=false doesn't help. Although, even if it did, I don't think it is a valid solution/workaround, as I am not in control of the tomcat deployment - I can't tell all my clients to add this property.

Note #2: I know that I can use EL empty operator. My concern right now is with existing code deployed at clients' sites.
Comment 1 Yoni Amir 2015-11-01 09:35:47 UTC
I forgot to add the error itself:

org.apache.jasper.JasperException: /index.jsp (line: 8, column: 12) attribute value for [test] is not properly terminated
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:275)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:91)
	org.apache.jasper.compiler.Parser.parseAttributeValue(Parser.java:270)
	org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:235)
	org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:163)
	org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:154)
	org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1236)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1455)
	org.apache.jasper.compiler.Parser.parse(Parser.java:139)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Comment 2 Violeta Georgieva 2015-11-02 12:55:32 UTC

*** This bug has been marked as a duplicate of bug 57136 ***
Comment 3 Yoni Amir 2015-11-02 13:01:24 UTC
Why did you resolve this bug as duplicate? They may sound similar but I think the severity of them is much different.
The other bug, 57136, exists in tomcat 7, and I never encountered it in my life or felt its pain in any way.
This bug, however, is a regression between 8.0.26 and 8.0.27 and is hurting my JSPs very badly.
57136 is about $ and #, this bug is about quotes.
Comment 4 Mark Thomas 2015-11-02 13:03:27 UTC
This was correctly marked as a duplicate of 57136.

This issue described is not a regression, it is a side effect of fixing the long standing bug in EL parsing described in 57136.

*** This bug has been marked as a duplicate of bug 57136 ***
Comment 5 Yoni Amir 2015-11-02 13:09:42 UTC
Hi Mark,
I am not sure if I understand your claim: you are saying that the side-effect is not a regression. Are you saying that it is a desired side-effect?
Also, I see that 57136 is still open. Are there plans to fix it soon? Was this fix that you refer to (the one that created the side-effect) applied in 8.0.27?
Thanks,
Yoni
Comment 6 Mark Thomas 2015-11-02 13:32:20 UTC
(In reply to Yoni Amir from comment #5)

Try reading the bug report for 57136. The answers to all of your questions may be found there.

> I am not sure if I understand your claim: you are saying that the
> side-effect is not a regression.

Yes.

> Are you saying that it is a desired side-effect?

Yes.

> Also, I see that 57136 is still open.

It is open for an enhancement to add an option to restore the broken behaviour to give those users with broken web applications to upgrade to newer Tomcat versions without having to fix their applications.

> Are there plans to fix it soon?

The issue has already been fixed. There are no plans to implement the enhancement that I am aware of.

> Was  this fix that you refer to (the one that created the side-effect)
> applied in 8.0.27?

Yes.