beckchr / juel Goto Github PK
View Code? Open in Web Editor NEWJava Unified Expression Language
Home Page: http://juel.sf.net
License: Apache License 2.0
Java Unified Expression Language
Home Page: http://juel.sf.net
License: Apache License 2.0
[Issue migrated from SourceForge | ID: 2590830 | Submitted by 'awiner']
[http://sourceforge.net/support/tracker.php?aid=2590830]
SimpleContext.getVariableMapper() (and getFunctionMapper()) both return null until setFunction() or setVariable() is called. However, neither of those functions are part of the ELContext API, so there is no way to get a non-null variable mapper without downcasting.
[Issue migrated from SourceForge | ID: 2779833 | Submitted by 'ychawla']
[http://sourceforge.net/support/tracker.php?aid=2779833]
While using Camel 1.6.0 and juel 2.1.1 jar, I get the following error when trying to use an EL expression:
javax.el.MethodNotFoundException: Cannot resolve method 'startsWith' in 'class java.lang.String'
The expression is ${in.headers['MyHeader'].startsWith('fooBar')}
However, the same expression works fine with the JUEL 2.1.0 jar which is distributed by Camel.
I haven't reported a bug here before so I am not sure if I am following the correct procedure. Hopefully, it is all good. The discussion post link from the Camel boards is:
http://www.nabble.com/Camel-JUEL-expression-weirdness-in-1.6.0-td23177119.html
Thanks,
Yogesh
[Issue migrated from SourceForge | ID: 3031783 | Submitted by 'struberg']
[http://sourceforge.net/support/tracker.php?aid=3031783]
Currently the ct in TreeMethodExpression checks for a paramType != null
However, JSR-214 section 2.12.4 createMethodExpression(ELContext, String, Class, Class[]) defines:
"expectedParamTypes - The expected parameter types for the method to be found. Must be an
array with no elements if there are no parameters expected. It is illegal to pass null, unless the method
is specified with arguments in the EL expression, in which case these arguments are used for method
selection, and this parameter is ignored."
and exactly the unless clause seems not to be working.
[Issue migrated from SourceForge | ID: 2779833 | Submitted by 'ychawla']
[http://sourceforge.net/support/tracker.php?aid=2779833]
While using Camel 1.6.0 and juel 2.1.1 jar, I get the following error when trying to use an EL expression:
javax.el.MethodNotFoundException: Cannot resolve method 'startsWith' in 'class java.lang.String'
The expression is ${in.headers['MyHeader'].startsWith('fooBar')}
However, the same expression works fine with the JUEL 2.1.0 jar which is distributed by Camel.
I haven't reported a bug here before so I am not sure if I am following the correct procedure. Hopefully, it is all good. The discussion post link from the Camel boards is:
http://www.nabble.com/Camel-JUEL-expression-weirdness-in-1.6.0-td23177119.html
Thanks,
Yogesh
[Issue migrated from SourceForge | ID: 2871773 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871773]
In expressions like ${fnc:size(items)==0 || items[0]==null} the second part "items[0]==null" should be evaluated only when first part is false. But with current implementation both parts of boolean condition are evaluated - therefore it throws javax.el.PropertyNotFoundException in such case.
There is attached test case
[Issue migrated from SourceForge | ID: 1575123 | Submitted by 'fesnault']
[http://sourceforge.net/support/tracker.php?aid=1575123]
If you work with SimpleContext and SimpleResolver,
paths with '[]' syntax will not work if the data are
stored in an ArrayList :
" The class 'java.util.ArrayList' does not have the
property '0' "
ListELResolver must be included to have it work.
[Issue migrated from SourceForge | ID: 1575123 | Submitted by 'fesnault']
[http://sourceforge.net/support/tracker.php?aid=1575123]
If you work with SimpleContext and SimpleResolver,
paths with '[]' syntax will not work if the data are
stored in an ArrayList :
" The class 'java.util.ArrayList' does not have the
property '0' "
ListELResolver must be included to have it work.
[Issue migrated from SourceForge | ID: 3095122 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=3095122]
Method expression ${...foo.bar} fails with IllegalAccessException, where foo is an instance of a non-public inner class and bar() a public method implemented by this class. Thanks to Martin Koci for reporting this.
[Issue migrated from SourceForge | ID: 2487917 | Submitted by 'sbattaglia']
[http://sourceforge.net/support/tracker.php?aid=2487917]
The binary for 2.1.1-rc1 requires Java 6. I'm not sure if this is an error, so I'm logging it here. 2.1.0 had worked fine under Java 1.5.
Thanks
-Scott
[Issue migrated from SourceForge | ID: 2590830 | Submitted by 'awiner']
[http://sourceforge.net/support/tracker.php?aid=2590830]
SimpleContext.getVariableMapper() (and getFunctionMapper()) both return null until setFunction() or setVariable() is called. However, neither of those functions are part of the ELContext API, so there is no way to get a non-null variable mapper without downcasting.
[Issue migrated from SourceForge | ID: 2779833 | Submitted by 'ychawla']
[http://sourceforge.net/support/tracker.php?aid=2779833]
While using Camel 1.6.0 and juel 2.1.1 jar, I get the following error when trying to use an EL expression:
javax.el.MethodNotFoundException: Cannot resolve method 'startsWith' in 'class java.lang.String'
The expression is ${in.headers['MyHeader'].startsWith('fooBar')}
However, the same expression works fine with the JUEL 2.1.0 jar which is distributed by Camel.
I haven't reported a bug here before so I am not sure if I am following the correct procedure. Hopefully, it is all good. The discussion post link from the Camel boards is:
http://www.nabble.com/Camel-JUEL-expression-weirdness-in-1.6.0-td23177119.html
Thanks,
Yogesh
[Issue migrated from SourceForge | ID: 2590830 | Submitted by 'awiner']
[http://sourceforge.net/support/tracker.php?aid=2590830]
SimpleContext.getVariableMapper() (and getFunctionMapper()) both return null until setFunction() or setVariable() is called. However, neither of those functions are part of the ELContext API, so there is no way to get a non-null variable mapper without downcasting.
[Issue migrated from SourceForge | ID: 2487917 | Submitted by 'sbattaglia']
[http://sourceforge.net/support/tracker.php?aid=2487917]
The binary for 2.1.1-rc1 requires Java 6. I'm not sure if this is an error, so I'm logging it here. 2.1.0 had worked fine under Java 1.5.
Thanks
-Scott
[Issue migrated from SourceForge | ID: 2822943 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2822943]
The BeanELResolver should use Method.setAccessible(true) to access non-public properties or public properties in non-public classes. Currently, the implementtion searches the interface/class hierarchy for a public method in a public class but does not try Method.setAccessible(true).
[Issue migrated from SourceForge | ID: 2714845 | Submitted by 'pa314159']
[http://sourceforge.net/support/tracker.php?aid=2714845]
The expressions evaluating a property having a name of an operator fail.
I added the following test method to de.odysseus.el.tree.impl.ParserTest
public void testPropertyOP() {
verifyEvalExpression("${a.empty}");
verifyEvalExpression("${a.not}");
verifyEvalExpression("${a.eq}");
verifyEvalExpression("${a.ne}");
// ...
}
All verifications throw an exception similar with
de.odysseus.el.tree.TreeBuilderException: Error parsing '${a.empty}': syntax error at position 4, encountered 'empty', expected
at de.odysseus.el.tree.impl.Builder.build(Builder.java:99)
at de.odysseus.el.TestCase.parse(TestCase.java:32)
at de.odysseus.el.tree.impl.ParserTest.verifyEvalExpression(ParserTest.java:31)
at de.odysseus.el.tree.impl.ParserTest.testProperty(ParserTest.java:209)
[Issue migrated from SourceForge | ID: 2822943 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2822943]
The BeanELResolver should use Method.setAccessible(true) to access non-public properties or public properties in non-public classes. Currently, the implementtion searches the interface/class hierarchy for a public method in a public class but does not try Method.setAccessible(true).
[Issue migrated from SourceForge | ID: 2912763 | Submitted by 'None']
[http://sourceforge.net/support/tracker.php?aid=2912763]
According to http://java.sun.com/javaee/6/docs/api/javax/el/ExpressionFactory.html createMethodExpression should accept null values for expectedReturnType and expectedParamTypes, if the parameters are present in the expression.
Using version 2.2.0 I am getting an ELException, when parsing the expression
with null values for the above mentioned parameters.
[Issue migrated from SourceForge | ID: 2912763 | Submitted by 'None']
[http://sourceforge.net/support/tracker.php?aid=2912763]
According to http://java.sun.com/javaee/6/docs/api/javax/el/ExpressionFactory.html createMethodExpression should accept null values for expectedReturnType and expectedParamTypes, if the parameters are present in the expression.
Using version 2.2.0 I am getting an ELException, when parsing the expression
with null values for the above mentioned parameters.
[Issue migrated from SourceForge | ID: 2912763 | Submitted by 'None']
[http://sourceforge.net/support/tracker.php?aid=2912763]
According to http://java.sun.com/javaee/6/docs/api/javax/el/ExpressionFactory.html createMethodExpression should accept null values for expectedReturnType and expectedParamTypes, if the parameters are present in the expression.
Using version 2.2.0 I am getting an ELException, when parsing the expression
with null values for the above mentioned parameters.
[Issue migrated from SourceForge | ID: 2871795 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871795]
The expression like ${items[0]} throws PropertyNotFoundException when items is empty list. Specification says to return null in such case
[Issue migrated from SourceForge | ID: 3031783 | Submitted by 'struberg']
[http://sourceforge.net/support/tracker.php?aid=3031783]
Currently the ct in TreeMethodExpression checks for a paramType != null
However, JSR-214 section 2.12.4 createMethodExpression(ELContext, String, Class, Class[]) defines:
"expectedParamTypes - The expected parameter types for the method to be found. Must be an
array with no elements if there are no parameters expected. It is illegal to pass null, unless the method
is specified with arguments in the EL expression, in which case these arguments are used for method
selection, and this parameter is ignored."
and exactly the unless clause seems not to be working.
[Issue migrated from SourceForge | ID: 2871773 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871773]
In expressions like ${fnc:size(items)==0 || items[0]==null} the second part "items[0]==null" should be evaluated only when first part is false. But with current implementation both parts of boolean condition are evaluated - therefore it throws javax.el.PropertyNotFoundException in such case.
There is attached test case
[Issue migrated from SourceForge | ID: 2779833 | Submitted by 'ychawla']
[http://sourceforge.net/support/tracker.php?aid=2779833]
While using Camel 1.6.0 and juel 2.1.1 jar, I get the following error when trying to use an EL expression:
javax.el.MethodNotFoundException: Cannot resolve method 'startsWith' in 'class java.lang.String'
The expression is ${in.headers['MyHeader'].startsWith('fooBar')}
However, the same expression works fine with the JUEL 2.1.0 jar which is distributed by Camel.
I haven't reported a bug here before so I am not sure if I am following the correct procedure. Hopefully, it is all good. The discussion post link from the Camel boards is:
http://www.nabble.com/Camel-JUEL-expression-weirdness-in-1.6.0-td23177119.html
Thanks,
Yogesh
[Issue migrated from SourceForge | ID: 3031783 | Submitted by 'struberg']
[http://sourceforge.net/support/tracker.php?aid=3031783]
Currently the ct in TreeMethodExpression checks for a paramType != null
However, JSR-214 section 2.12.4 createMethodExpression(ELContext, String, Class, Class[]) defines:
"expectedParamTypes - The expected parameter types for the method to be found. Must be an
array with no elements if there are no parameters expected. It is illegal to pass null, unless the method
is specified with arguments in the EL expression, in which case these arguments are used for method
selection, and this parameter is ignored."
and exactly the unless clause seems not to be working.
[Issue migrated from SourceForge | ID: 2748538 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2748538]
ValueExpression.setValue(...) always calls ELContext.setValue(...), even if an identifier is mapped to a value expression via VariableMapper.setVariable(...). The method should return after calling set value on the variable.
Originally reported by Gerhard Petracek.
[Issue migrated from SourceForge | ID: 2871795 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871795]
The expression like ${items[0]} throws PropertyNotFoundException when items is empty list. Specification says to return null in such case
[Issue migrated from SourceForge | ID: 1793090 | Submitted by 'gpf4sf']
[http://sourceforge.net/support/tracker.php?aid=1793090]
I am not very familiar with the specification, but I suppose that this is a bug and string concatenation should be supported.
The following code throws the javax.el.ELException: Cannot coerce 'f' to class java.lang.Long
String value = "\"f\" + \"d\"";
SimpleContext context = new SimpleContext();
ExpressionFactoryImpl factory = new ExpressionFactoryImpl();
ValueExpression expression = factory.createValueExpression(context, "${" + value + "}", Object.class);
System.err.println(expression.getValue(context));
I've fixed this by changing the de.odysseus.el.tree.impl.ast.AstBinary.ADD.apply() method.
public static final Operator ADD = new Operator() {
public Object apply(Object o1, Object o2) {
if(o1 instanceof String || o2 instanceof String) {
return (o1 != null ? o1.toString() : "") + (o2 != null ? o2.toString() : "");
} else {
return NumberOperations.add(o1, o2);
}
}
@OverRide public String toString() { return "+"; }
};
If this fix is correct please include it in the main branch.
Thank you,
Viktar
[Issue migrated from SourceForge | ID: 2871795 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871795]
The expression like ${items[0]} throws PropertyNotFoundException when items is empty list. Specification says to return null in such case
[Issue migrated from SourceForge | ID: 3031783 | Submitted by 'struberg']
[http://sourceforge.net/support/tracker.php?aid=3031783]
Currently the ct in TreeMethodExpression checks for a paramType != null
However, JSR-214 section 2.12.4 createMethodExpression(ELContext, String, Class, Class[]) defines:
"expectedParamTypes - The expected parameter types for the method to be found. Must be an
array with no elements if there are no parameters expected. It is illegal to pass null, unless the method
is specified with arguments in the EL expression, in which case these arguments are used for method
selection, and this parameter is ignored."
and exactly the unless clause seems not to be working.
[Issue migrated from SourceForge | ID: 2487917 | Submitted by 'sbattaglia']
[http://sourceforge.net/support/tracker.php?aid=2487917]
The binary for 2.1.1-rc1 requires Java 6. I'm not sure if this is an error, so I'm logging it here. 2.1.0 had worked fine under Java 1.5.
Thanks
-Scott
[Issue migrated from SourceForge | ID: 2822943 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2822943]
The BeanELResolver should use Method.setAccessible(true) to access non-public properties or public properties in non-public classes. Currently, the implementtion searches the interface/class hierarchy for a public method in a public class but does not try Method.setAccessible(true).
[Issue migrated from SourceForge | ID: 2714845 | Submitted by 'pa314159']
[http://sourceforge.net/support/tracker.php?aid=2714845]
The expressions evaluating a property having a name of an operator fail.
I added the following test method to de.odysseus.el.tree.impl.ParserTest
public void testPropertyOP() {
verifyEvalExpression("${a.empty}");
verifyEvalExpression("${a.not}");
verifyEvalExpression("${a.eq}");
verifyEvalExpression("${a.ne}");
// ...
}
All verifications throw an exception similar with
de.odysseus.el.tree.TreeBuilderException: Error parsing '${a.empty}': syntax error at position 4, encountered 'empty', expected
at de.odysseus.el.tree.impl.Builder.build(Builder.java:99)
at de.odysseus.el.TestCase.parse(TestCase.java:32)
at de.odysseus.el.tree.impl.ParserTest.verifyEvalExpression(ParserTest.java:31)
at de.odysseus.el.tree.impl.ParserTest.testProperty(ParserTest.java:209)
[Issue migrated from SourceForge | ID: 2871795 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871795]
The expression like ${items[0]} throws PropertyNotFoundException when items is empty list. Specification says to return null in such case
[Issue migrated from SourceForge | ID: 2748538 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2748538]
ValueExpression.setValue(...) always calls ELContext.setValue(...), even if an identifier is mapped to a value expression via VariableMapper.setVariable(...). The method should return after calling set value on the variable.
Originally reported by Gerhard Petracek.
[Issue migrated from SourceForge | ID: 2871773 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871773]
In expressions like ${fnc:size(items)==0 || items[0]==null} the second part "items[0]==null" should be evaluated only when first part is false. But with current implementation both parts of boolean condition are evaluated - therefore it throws javax.el.PropertyNotFoundException in such case.
There is attached test case
[Issue migrated from SourceForge | ID: 3093808 | Submitted by 'None']
[http://sourceforge.net/support/tracker.php?aid=3093808]
According to EL 2.2 specs, section 1.15 Functions, the namespace for functions is not required:
"The full syntax is that of qualified n-ary functions:
[ns:]f([a1[,a2[,...[,an]]]])"
However, the code in SimpleContext always concatenates the prefix with ':' and the function name. If the prefix is null, the resulting function key will be "null:". I think this is not correct as far as the 2.2 mrel specs is concerned.
The fix is pretty simple at first look - just test the prefix for null and if so, just construct the function key with the name, no 'null:' prefix.
[Issue migrated from SourceForge | ID: 2487917 | Submitted by 'sbattaglia']
[http://sourceforge.net/support/tracker.php?aid=2487917]
The binary for 2.1.1-rc1 requires Java 6. I'm not sure if this is an error, so I'm logging it here. 2.1.0 had worked fine under Java 1.5.
Thanks
-Scott
[Issue migrated from SourceForge | ID: 2748538 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2748538]
ValueExpression.setValue(...) always calls ELContext.setValue(...), even if an identifier is mapped to a value expression via VariableMapper.setVariable(...). The method should return after calling set value on the variable.
Originally reported by Gerhard Petracek.
[Issue migrated from SourceForge | ID: 1793090 | Submitted by 'gpf4sf']
[http://sourceforge.net/support/tracker.php?aid=1793090]
I am not very familiar with the specification, but I suppose that this is a bug and string concatenation should be supported.
The following code throws the javax.el.ELException: Cannot coerce 'f' to class java.lang.Long
String value = "\"f\" + \"d\"";
SimpleContext context = new SimpleContext();
ExpressionFactoryImpl factory = new ExpressionFactoryImpl();
ValueExpression expression = factory.createValueExpression(context, "${" + value + "}", Object.class);
System.err.println(expression.getValue(context));
I've fixed this by changing the de.odysseus.el.tree.impl.ast.AstBinary.ADD.apply() method.
public static final Operator ADD = new Operator() {
public Object apply(Object o1, Object o2) {
if(o1 instanceof String || o2 instanceof String) {
return (o1 != null ? o1.toString() : "") + (o2 != null ? o2.toString() : "");
} else {
return NumberOperations.add(o1, o2);
}
}
@OverRide public String toString() { return "+"; }
};
If this fix is correct please include it in the main branch.
Thank you,
Viktar
[Issue migrated from SourceForge | ID: 2590830 | Submitted by 'awiner']
[http://sourceforge.net/support/tracker.php?aid=2590830]
SimpleContext.getVariableMapper() (and getFunctionMapper()) both return null until setFunction() or setVariable() is called. However, neither of those functions are part of the ELContext API, so there is no way to get a non-null variable mapper without downcasting.
[Issue migrated from SourceForge | ID: 1793090 | Submitted by 'gpf4sf']
[http://sourceforge.net/support/tracker.php?aid=1793090]
I am not very familiar with the specification, but I suppose that this is a bug and string concatenation should be supported.
The following code throws the javax.el.ELException: Cannot coerce 'f' to class java.lang.Long
String value = "\"f\" + \"d\"";
SimpleContext context = new SimpleContext();
ExpressionFactoryImpl factory = new ExpressionFactoryImpl();
ValueExpression expression = factory.createValueExpression(context, "${" + value + "}", Object.class);
System.err.println(expression.getValue(context));
I've fixed this by changing the de.odysseus.el.tree.impl.ast.AstBinary.ADD.apply() method.
public static final Operator ADD = new Operator() {
public Object apply(Object o1, Object o2) {
if(o1 instanceof String || o2 instanceof String) {
return (o1 != null ? o1.toString() : "") + (o2 != null ? o2.toString() : "");
} else {
return NumberOperations.add(o1, o2);
}
}
@OverRide public String toString() { return "+"; }
};
If this fix is correct please include it in the main branch.
Thank you,
Viktar
[Issue migrated from SourceForge | ID: 1575123 | Submitted by 'fesnault']
[http://sourceforge.net/support/tracker.php?aid=1575123]
If you work with SimpleContext and SimpleResolver,
paths with '[]' syntax will not work if the data are
stored in an ArrayList :
" The class 'java.util.ArrayList' does not have the
property '0' "
ListELResolver must be included to have it work.
[Issue migrated from SourceForge | ID: 2912763 | Submitted by 'None']
[http://sourceforge.net/support/tracker.php?aid=2912763]
According to http://java.sun.com/javaee/6/docs/api/javax/el/ExpressionFactory.html createMethodExpression should accept null values for expectedReturnType and expectedParamTypes, if the parameters are present in the expression.
Using version 2.2.0 I am getting an ELException, when parsing the expression
with null values for the above mentioned parameters.
[Issue migrated from SourceForge | ID: 2822943 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2822943]
The BeanELResolver should use Method.setAccessible(true) to access non-public properties or public properties in non-public classes. Currently, the implementtion searches the interface/class hierarchy for a public method in a public class but does not try Method.setAccessible(true).
[Issue migrated from SourceForge | ID: 2748538 | Submitted by 'beckchr']
[http://sourceforge.net/support/tracker.php?aid=2748538]
ValueExpression.setValue(...) always calls ELContext.setValue(...), even if an identifier is mapped to a value expression via VariableMapper.setVariable(...). The method should return after calling set value on the variable.
Originally reported by Gerhard Petracek.
[Issue migrated from SourceForge | ID: 2714845 | Submitted by 'pa314159']
[http://sourceforge.net/support/tracker.php?aid=2714845]
The expressions evaluating a property having a name of an operator fail.
I added the following test method to de.odysseus.el.tree.impl.ParserTest
public void testPropertyOP() {
verifyEvalExpression("${a.empty}");
verifyEvalExpression("${a.not}");
verifyEvalExpression("${a.eq}");
verifyEvalExpression("${a.ne}");
// ...
}
All verifications throw an exception similar with
de.odysseus.el.tree.TreeBuilderException: Error parsing '${a.empty}': syntax error at position 4, encountered 'empty', expected
at de.odysseus.el.tree.impl.Builder.build(Builder.java:99)
at de.odysseus.el.TestCase.parse(TestCase.java:32)
at de.odysseus.el.tree.impl.ParserTest.verifyEvalExpression(ParserTest.java:31)
at de.odysseus.el.tree.impl.ParserTest.testProperty(ParserTest.java:209)
[Issue migrated from SourceForge | ID: 2871773 | Submitted by 'pvojtechovsky']
[http://sourceforge.net/support/tracker.php?aid=2871773]
In expressions like ${fnc:size(items)==0 || items[0]==null} the second part "items[0]==null" should be evaluated only when first part is false. But with current implementation both parts of boolean condition are evaluated - therefore it throws javax.el.PropertyNotFoundException in such case.
There is attached test case
[Issue migrated from SourceForge | ID: 1575123 | Submitted by 'fesnault']
[http://sourceforge.net/support/tracker.php?aid=1575123]
If you work with SimpleContext and SimpleResolver,
paths with '[]' syntax will not work if the data are
stored in an ArrayList :
" The class 'java.util.ArrayList' does not have the
property '0' "
ListELResolver must be included to have it work.
[Issue migrated from SourceForge | ID: 2714845 | Submitted by 'pa314159']
[http://sourceforge.net/support/tracker.php?aid=2714845]
The expressions evaluating a property having a name of an operator fail.
I added the following test method to de.odysseus.el.tree.impl.ParserTest
public void testPropertyOP() {
verifyEvalExpression("${a.empty}");
verifyEvalExpression("${a.not}");
verifyEvalExpression("${a.eq}");
verifyEvalExpression("${a.ne}");
// ...
}
All verifications throw an exception similar with
de.odysseus.el.tree.TreeBuilderException: Error parsing '${a.empty}': syntax error at position 4, encountered 'empty', expected
at de.odysseus.el.tree.impl.Builder.build(Builder.java:99)
at de.odysseus.el.TestCase.parse(TestCase.java:32)
at de.odysseus.el.tree.impl.ParserTest.verifyEvalExpression(ParserTest.java:31)
at de.odysseus.el.tree.impl.ParserTest.testProperty(ParserTest.java:209)
[Issue migrated from SourceForge | ID: 1793090 | Submitted by 'gpf4sf']
[http://sourceforge.net/support/tracker.php?aid=1793090]
I am not very familiar with the specification, but I suppose that this is a bug and string concatenation should be supported.
The following code throws the javax.el.ELException: Cannot coerce 'f' to class java.lang.Long
String value = "\"f\" + \"d\"";
SimpleContext context = new SimpleContext();
ExpressionFactoryImpl factory = new ExpressionFactoryImpl();
ValueExpression expression = factory.createValueExpression(context, "${" + value + "}", Object.class);
System.err.println(expression.getValue(context));
I've fixed this by changing the de.odysseus.el.tree.impl.ast.AstBinary.ADD.apply() method.
public static final Operator ADD = new Operator() {
public Object apply(Object o1, Object o2) {
if(o1 instanceof String || o2 instanceof String) {
return (o1 != null ? o1.toString() : "") + (o2 != null ? o2.toString() : "");
} else {
return NumberOperations.add(o1, o2);
}
}
@OverRide public String toString() { return "+"; }
};
If this fix is correct please include it in the main branch.
Thank you,
Viktar
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.