Bug 45511 - EL "empty" keyword does not work
Summary: EL "empty" keyword does not work
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
: 45937 46084 46596 46965 (view as bug list)
Depends on:
Blocks: 42565
  Show dependency tree
Reported: 2008-07-31 02:36 UTC by Grzegorz Grzybek
Modified: 2014-02-17 13:42 UTC (History)
6 users (show)


Note You need to log in before you can comment on or make changes to this bug.
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. ***