Bug 49217 - Accepting java keyword in EL
Summary: Accepting java keyword in EL
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.26
Hardware: PC Windows XP
: P2 minor (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
: 50120 50850 51728 (view as bug list)
Depends on:
Reported: 2010-04-29 05:32 UTC by sekhar
Modified: 2014-02-17 13:52 UTC (History)
3 users (show)

Patch for 6.0.x (5.70 KB, application/octet-stream)
2010-07-07 05:19 UTC, Mark Thomas
Patch for 6.0.x v2 (6.74 KB, patch)
2010-07-07 07:33 UTC, Mark Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sekhar 2010-04-29 05:32:05 UTC
According to EL, the Whatever comes to the right of the dot operator must follow normal Java naming rules for identifiers. For example it must not be a Java Key word (Here the example is shown for int, which is a Java key word).

// Java Bean
package library;
public class Book {
private String title;
public void setInt(String title) {
this.title = title;
public String getInt() {
return title;
// JSP
library.Book book = new library.Book();
book.setInt("sample title");
request.setAttribute("book", book);
sample title
Comment 1 Mark Thomas 2010-05-18 17:27:24 UTC
For Tomcat 5, the EL support is provided by commons EL so you'll need to raise a bug in that issue tracker - https://issues.apache.org/jira/browse/EL. Given the lack activity, I doubt it will get fixed.

For Tomcat 6/7 Tomcat has a new EL parser implementation. It should be possible to fix this for those versions so I am moving this issue to Tomcst 6.
Comment 2 Mark Thomas 2010-07-05 17:47:39 UTC
Thanks for the report. This has been fixed in 7.0.x and will be in 7.0.1 onwards. It has also been proposed for 6.0.x
Comment 3 Konstantin Kolinko 2010-07-06 06:34:01 UTC
Reading jsp-2_1-fr-spec-el.pdf (Expression Language Specification Version 2.1, Final Release),

1) page 21: (35/122)

"An identifier is constrained to be a Java identifier - e.g., no -, no /, etc."

I think that it says nothing about reserved Java keywords. It is just about syntax, not the reserved names.

2) page 15: (29/122)
chapter 1.14 ReservedWords
has a list of reserved words that is far shorter than the one implemented in r960712
Comment 4 Mark Thomas 2010-07-06 08:08:57 UTC
Java identifier is defined by the Java Language Specification and explicitly states keywords are not permitted. The definition is actually even stricter than currently implemented. I'll look at tightening that up.
Comment 5 Mark Thomas 2010-07-07 05:19:44 UTC
Created attachment 25726 [details]
Patch for 6.0.x

Back port of changes to 7.0.x with an additional option to disable the check
Comment 6 Mark Thomas 2010-07-07 07:33:17 UTC
Created attachment 25727 [details]
Patch for 6.0.x v2

Updated patch
Comment 7 Mark Thomas 2010-11-03 14:37:38 UTC
The updated patch has been applied to 6.0.x and will be included in 6.0.30 onwards.
Comment 8 Konstantin Kolinko 2010-11-15 10:57:23 UTC
*** Bug 50120 has been marked as a duplicate of this bug. ***
Comment 9 Konstantin Kolinko 2010-11-15 10:59:45 UTC
Note, that in 6.0 this check is off by default.
One has to set org.apache.el.parser.SKIP_IDENTIFIER_CHECK property to "false" to enable it.
Comment 10 Konstantin Kolinko 2011-03-01 13:36:54 UTC
*** Bug 50850 has been marked as a duplicate of this bug. ***
Comment 11 eldar.kamalov 2011-03-02 04:06:44 UTC
Does not work in 7.0.4
Comment 12 Mark Thomas 2011-03-02 04:51:19 UTC
(In reply to comment #11)
> Does not work in 7.0.4

Tomcat's 7's behaviour is as per the EL specification although the identifier check can be disabled as a temporary work-around for non-specification compliant applications.

If you have any further questions on this, the users list is the place to seek help.
Comment 13 eldar.kamalov 2011-03-02 08:29:37 UTC
> If you have any further questions on this, the users list is the place to seek
> help.

OK, can you point me to the "users list"?
Comment 14 Konstantin Kolinko 2011-03-02 10:56:12 UTC
(In reply to comment #13)
> OK, can you point me to the "users list"?

has the link
Comment 15 Konstantin Kolinko 2011-08-26 21:59:15 UTC
*** Bug 51728 has been marked as a duplicate of this bug. ***
Comment 16 Marcio Lucca 2011-09-02 13:57:44 UTC
I don't know guys, I just ran into the same problem and I'll have to agree with Konstantin on comment 3: both specs 2.1 and 2.2 have that "Reserved Words" section, and neither contains "class" as a keyword. It makes you wonder: "why would both specifications contain that section anyway?" .It seems to me the specification is contradicting itself, so both interpretations might be considered correct. Still this is something I think needs clarification from the JCP. Otherwise be certain that this bug will continue being duplicated over and over again.

Just my 2 cents.
Comment 17 Mark Thomas 2011-09-02 14:12:33 UTC
The EL specification, Tomcat's implementation, the EL TCK and the EL expert group are all in agreement. EL identifiers must be valid Java identifiers as per the Java language specification. No further clarification is required.

The org.apache.el.parser.SKIP_IDENTIFIER_CHECK is provided for non-specification compliant applications but is is strongly recommended that applications fix any bugs that rely on this feature for a work-around.