Bug 56185

Summary: Jasper to compile compile complicated EL expression
Product: Tomcat 8 Reporter: Sergey <serge.pak>
Component: ELAssignee: Tomcat Developers Mailing List <dev>
Severity: regression    
Priority: P2    
Version: 8.0.3   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Sergey 2014-02-25 07:24:55 UTC
The following jsp fails to compile: 
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="myBean" scope="request" class="com.MyBean"/>
<c:if test="${(myBean.int1 > 1 and myBean.myBool) or ((myBean.myBool or myBean.myBool1) and myBean.int1 > 1)}">Hello world</c:if>

If I simplify test expression to: (myBean.int1 > 1 and myBean.myBool) or (myBean.myBool and myBean.int1 > 1) i.e. replace (myBean.myBool or myBean.myBool1) with myBean.myBool, then compilation will work.

It looks like Jasper cannot compile EL expressions with depth that is higher than a certain value (4?)

Exception as follows
org.apache.jasper.JasperException: /testCompile.jsp (line: 26, column: 0) "${(myBean.int1 > 1 and myBean.myBool) or ((myBean.myBool or myBean.myBool) and myBean.int1 > 1)}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${(myBean.int1 > 1 and myBean.myBool) or ((myBean.myBool or myBean.myBool) and myBean.int1 > 1)}]

Works properly in Tomcat 6 and Tomcat 7.
Comment 1 Konstantin Kolinko 2014-02-25 15:35:53 UTC
It is reproducible in 8.0.3, but not in the current trunk.
So I think that it was fixed with bug 56179 - r1571242 and r1571245

To reproduce I put the text from Description as examples/test.jsp with s/class="com.MyBean"/class="cal.TableBean"/

In 8.0.3 it fails at compile time with "contains invalid expression(s)".
In current trunk it compiles successfully and fails at runtime (trying to access a property that "cal.TableBean" does not have).

Closing as duplicate.

*** This bug has been marked as a duplicate of bug 56179 ***