Summary: | jsp /expression language ternary expression without space before colon stopped working | ||
---|---|---|---|
Product: | Tomcat 6 | Reporter: | Thomas Wiesel <thomas.wiesel> |
Component: | Jasper | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | lizongbo, mkmelin+apache |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | default | ||
Hardware: | Other | ||
OS: | All | ||
Bug Depends on: | 45511 | ||
Bug Blocks: | |||
Attachments: |
Patch for this bug
Cleaner patch |
Description
Thomas Wiesel
2007-06-01 08:43:44 UTC
The problem seems to be with the "false?true:false" part of the expression (the same excepion is thrown specifying just "${false?true:false}". As a workaround, adding a space before the colon seems to resolve it - both the following work OK: ${false?true :false} ${true? (false?true :false):false} Now to understand JavaCC/JJTree to work out why... I confirm the same problem! I am trying to keep up to date and want to move to Tomcat 6, too. Also, it is not a Windows specific problem... Same goes for Tomcat 6 in Linux1 It is a very annoying problem for people who have the - good - habit of using EL expressions. Anybody knows if it is truly considered a bug and if it is going to be fixed? I can confirm this too. If the ternary expression doesn't have space before the colon it doesn't work, as pointed out in comment 1. This is really blocking me from upgrading to tomcat6. Created attachment 20913 [details]
Patch for this bug
This patch fixes this bug (possible incorrect presumption that the presence of
a ":" involves a function call when a value was specified) and another minor
bug (valid namespaces names are not detected as such.) I was not able to find
this bug, but checking the grammar and checking the specification makes this
very simple to detect. The fix for this second bug does not follow the standard
guidelines but it is closer to doing so than the previous grammar.
Created attachment 20975 [details]
Cleaner patch
Cleaner patch
The only real modification is on the .jjt file, everything else was auto generated by jjtree. *** Bug 43714 has been marked as a duplicate of this bug. *** I can reproduce the bug only if the operand left of the colon is *NOT* a string literal or a numeric literal. (In reply to comment #9) > I can reproduce the bug only if the operand left of the colon is *NOT* a string > literal or a numeric literal. Can you reproduce the bug with the test case you are using is you apply the patch? So can the patch be checked in? Would like to move to tc6... (In reply to comment #11) > So can the patch be checked in? Would like to move to tc6... > the patch works fine for us, please check in, thanks a lot! Many thanks for the patch. It has been applied to trunk and proposed for 6.0.x This was applied to 6.0.x and included in 6.0.18 onwards. However, this patch caused a regression: bug 45511 |