Bug 56031 - Tomcat 7.0.50 breaks on valid EL ternary expressions
Summary: Tomcat 7.0.50 breaks on valid EL ternary expressions
Status: RESOLVED DUPLICATE of bug 56029
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 7.0.50
Hardware: PC Mac OS X 10.4
: P2 regression (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2014-01-18 20:53 UTC by Fabrizio Giustina
Modified: 2014-01-18 21:57 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Fabrizio Giustina 2014-01-18 20:53:00 UTC
After migrating an existing webapp to tomcat 7.0.50 I started getting exceptions for EL expressions that worked fine in previous versions (everything seems to work just fine in 7.0.47 and previous versions, also tomcat 6.0.x).

All the errors I got were related to ternary expressions, and the error reported a strange corrupted version of the expression.

This is a sample expression:
${my:link(!empty registration ? registration : ‘/test/registration')}

And this is the error I get:
org.apache.jasper.JasperException: /WEB-INF/tags/project/tool.tag (line: 224, column: 110) "${my:link(!empty registration ? registration : '/test/registration')}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${my:link(!emptyregistration?::'/test/registration')}]

As you can see in the error tomcat reports the expression as "${my:link(!emptyregistration?::’/test/registration')}", removing all the whitespace and also replacing the "registration" variable with ":".

I checked all the settings to see if there may be a problem with the file encoding, whitespace characters or similar, but everything looks ok. After downgrading to 7.0.47 with the same webapp and settings everything works ok.

I got several other errors in similar expressions, for all of them the expression reported in the errors has all the whitespace removed.

I did a few tests and for this specific case I can make it work by changing it in the following way:
${my:link(!empty registration ? registration : ‘/test/registration')} -> does not work
${my:link(!empty registration ? 'test' : ‘/test/registration')} -> works

If this matters, the problems showed up in jsp tag files, with declared jsp version 2.0 (<jsp:root version="2.0" ), xml format. Tested both on mac osx/java6 and redhat linux/java6.

I couldn't find anything that may be related in jasper changelog between 7.0.47 and 7.0.50... do you have any idea if there is something that could cause this behaviour?
Comment 1 Mark Thomas 2014-01-18 21:04:27 UTC

*** This bug has been marked as a duplicate of bug 56029 ***
Comment 2 Mark Thomas 2014-01-18 21:34:01 UTC
Just to be on the safe side I added your example as a test case to 8.0.x and with the fix in place it passes so this is already fixed in trunk and 7.0.x and will be in 8.0.0 and 7.0.51 onwards.
Comment 3 Fabrizio Giustina 2014-01-18 21:57:55 UTC
thanks for the prompt response Mark