Bug 56185 - Jasper to compile compile complicated EL expression
Summary: Jasper to compile compile complicated EL expression
Status: RESOLVED DUPLICATE of bug 56179
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: EL (show other bugs)
Version: 8.0.3
Hardware: PC All
: P2 regression (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-25 07:24 UTC by Sergey
Modified: 2014-02-25 15:35 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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)}]
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:276)
.....

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 ***