jakartaee / expression-language

Jakarta Expression Language
https://eclipse.org/ee4j/el
Other
68 stars 49 forks source link

#{list} evaluation problems #21

Closed glassfishrobot closed 11 years ago

glassfishrobot commented 13 years ago

1. #

{obj.234}

throws Caused by: com.sun.el.parser.ParseException: Encountered ".1" at line 1, column NN. Was expecting one of: "}" ... "." ... "[" ... ">" ... "gt" ... "<" ... "lt" ... ">=" ... "ge" ... "<=" ... "le" ... "==" ... "eq" ... "!=" ... "ne" ... "&&" ... "and" ... "||" ... "or" ... "*" ... "+" ... "-" ... "?" ... "/" ... "div" ... "%" ... "mod" ...

at com.sun.el.parser.ELParser.generateParseException(ELParser.java:2252) at com.sun.el.parser.ELParser.jj_consume_token(ELParser.java:2134) at com.sun.el.parser.ELParser.DeferredExpression(ELParser.java:113) at com.sun.el.parser.ELParser.CompositeExpression(ELParser.java:40) at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:139) instead of indexing obj that implements List returning element at index 234.

2. #

{obj[true]}

where obj implements List proceeds successfully, but must throw an error.

3. #

{obj.true}

throws Caused by: com.sun.el.parser.ParseException: Encountered "" at line 1, column NN. Was expecting one of:

at com.sun.el.parser.ELParser.generateParseException(ELParser.java:2252) at com.sun.el.parser.ELParser.jj_consume_token(ELParser.java:2134) at com.sun.el.parser.ELParser.DotSuffix(ELParser.java:1058) at com.sun.el.parser.ELParser.ValueSuffix(ELParser.java:1035) at com.sun.el.parser.ELParser.Value(ELParser.java:980) at com.sun.el.parser.ELParser.Unary(ELParser.java:950) at com.sun.el.parser.ELParser.Multiplication(ELParser.java:714) at com.sun.el.parser.ELParser.Math(ELParser.java:634) at com.sun.el.parser.ELParser.Compare(ELParser.java:446) at com.sun.el.parser.ELParser.Equality(ELParser.java:340) at com.sun.el.parser.ELParser.And(ELParser.java:284) at com.sun.el.parser.ELParser.Or(ELParser.java:228) at com.sun.el.parser.ELParser.Choice(ELParser.java:182) at com.sun.el.parser.ELParser.Expression(ELParser.java:174) at com.sun.el.parser.ELParser.DeferredExpression(ELParser.java:112) at com.sun.el.parser.ELParser.CompositeExpression(ELParser.java:40) at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:139)

instead of meaningful error message, obj implements List.

4. #

{obj['']}

throws java.lang.NumberFormatException: For input string: "" instead of returning 0-indexed element.

5. #

{obj[null]}

returns null instead of 0-indexed element.

Environment

Operating System: All Platform: All

Affected Versions

[current]

glassfishrobot commented 6 years ago
glassfishrobot commented 13 years ago

@glassfishrobot Commented Reported by arkadi

glassfishrobot commented 13 years ago

@glassfishrobot Commented kchung said: 1. and 3. The operands for the . operator must be identifiers (see 1.19 EL spec), and cannot be numerics or reserved words.

4. Assuming that obj is a List, the operand must be a numeric.

5. obj[null] IS null, per EL spec 1.6.

2. This is the only bug, and should be fixed.

Thanks.

glassfishrobot commented 11 years ago

@glassfishrobot Commented kchung said: 2 seems to have been fixed in EL 3.0

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA UEL-21

glassfishrobot commented 11 years ago

@glassfishrobot Commented Marked as fixed on Friday, March 15th 2013, 11:43:47 am