jstl-api icon indicating copy to clipboard operation
jstl-api copied to clipboard

Bug in JSTL expression evaluator

Open rop49 opened this issue 4 years ago • 1 comments

When upgrading a legacy jsp-application with latest spring-boot dependencies, it looks like we hit a minor bug in: javax.servlet:jstl:jar:1.2

Testcase:

<c:set var="zz" value="${1}" />
<c:if test="${(zz) > 0}">XXX</c:if>

in a jsp-file, yields a compilation-error:

[${(zz) > 0}] contains invalid expression(s): [javax.el.ELException: Error Parsing: ${(zz) > 0}]

This error did not occur in the older version. For some reason, it seems it rejects the paranthesized expression: (zz) when there is only a single variable inside. Remove the parenthesis, and the error goes away. Also, if you for example change the code to: <c:if test="${(zz+zz) > 0}">XXX</c:if> or <c:if test="${(1) > 0}">XXX</c:if> these are both accepted without any errors.

rop49 avatar May 10 '21 12:05 rop49