Bug 45511

Summary: EL "empty" keyword does not work
Product: Tomcat 6 Reporter: Grzegorz Grzybek <grzegorz.grzybek>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: major CC: Bram.deKruijff, duong.thai.le, fgiust, juanhernandezgomez, mkmelin+apache, vimilsaju
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   
Bug Depends on:    
Bug Blocks: 42565    

Description Grzegorz Grzybek 2008-07-31 02:36:27 UTC
When using ${empty(xxx)}, EL parser thinks it is an unknown function :empty and throws ClassCastException:

java.lang.ClassCastException: java.lang.NullPointerException
	at org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:135)
	at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:147)
	at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:190)
	at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
	at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:924)

I think it is because of some changes in ELParser.java....

with best regards
Grzegorz Grzybek
Comment 1 Mark Thomas 2008-07-31 07:12:06 UTC
It looks like it is caused by the fix for 42565. That fix causes issues with use of brackets and whitespace.

For example, these work:
${empty ('')}
${(true) and (false)}

but these fail:

The workaround is to add some white space. I'm currently looking at the jjt file.
Comment 2 Mark Thomas 2008-08-01 09:21:06 UTC
I have applied a fix to trunk and proposed the fix for 6.0.x.

My testing shows no issues with the new fix but additional testing is always welcome.
Comment 3 Mark Thomas 2008-08-13 15:46:42 UTC
This fix has been applied to 6.0.x and will be included in 6.0.19 onwards.
Comment 4 Mark Thomas 2008-10-03 05:54:34 UTC
*** Bug 45937 has been marked as a duplicate of this bug. ***
Comment 5 Mark Thomas 2008-10-24 12:01:18 UTC
*** Bug 46084 has been marked as a duplicate of this bug. ***
Comment 6 Mark Thomas 2009-01-31 02:35:57 UTC
*** Bug 46596 has been marked as a duplicate of this bug. ***
Comment 7 Mark Thomas 2009-04-03 15:26:56 UTC
*** Bug 46965 has been marked as a duplicate of this bug. ***