Bug 61816

Summary: Jsp Precompile doesn't fail on ${}
Product: Tomcat 8 Reporter: Fresh Codemonger <freshcodemonger>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.5.13   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Fresh Codemonger 2017-11-24 22:39:31 UTC
Fails at runtime with:

Failed to parse the expression [${}] Encountered " "}" "} "" at line 1, column 3.
Was expecting one of:
"{" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"null" ...
"(" ...
"[" ...
"!" ...
"not" ...
"empty" ...
"-" ...
...
...
"(" ...
Comment 1 Mark Thomas 2017-11-24 23:09:04 UTC
That is consistent with the current behaviour without pre-compilation. The error is triggered at runtime so I wouldn't expect it to be triggered by pre-compilation.

The question is should ${} trigger a translation error or not. That needs some spec research.
Comment 2 Mark Thomas 2017-11-25 19:30:21 UTC
<quote>
JSP.2.7
JSP containers are required to produce a translation error when a syntactically
invalid EL expression is encountered in an attribute value or within template text.
</quote>

And, since ${} is not valid there should be a translation error (i.e. a compile time error). The fix looks fairly simple.
Comment 3 Mark Thomas 2017-11-25 19:48:33 UTC
Fixed in:
- trunk for 9.0.2 onwards
- 8.5.x for 8.5.24 onwards
- 8.0.x for 8.0.48 onwards
- 7.0.x for 7.0.83 onwards