Code Monkey home page Code Monkey logo

juel's People

Contributors

adamcrume avatar beckchr avatar danhaywood avatar dnfkuzi avatar meniluca avatar panhongliang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

juel's Issues

BeanELResolver should use Method.setAccessible(true)

[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).

String concatenation

[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

Bug in ExpressionFactory.createMethodExpression() ?

[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

{controller.createAddress(addr.street, addr.postalCode, addr.city)}

with null values for the above mentioned parameters.

String concatenation

[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

Checks in TreeMethodExpression are too restrictive

[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.

Bug in ExpressionFactory.createMethodExpression() ?

[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

{controller.createAddress(addr.street, addr.postalCode, addr.city)}

with null values for the above mentioned parameters.

SimpleContext.getVariableMapper() returns null

[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.

SimpleContext.getVariableMapper() returns null

[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.

SimpleResolver does not handle Lists

[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.

Checks in TreeMethodExpression are too restrictive

[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.

IllegalAccessException in method expression

[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.

Evaluation of second operand in condition

[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

Bug in ExpressionFactory.createMethodExpression() ?

[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

{controller.createAddress(addr.street, addr.postalCode, addr.city)}

with null values for the above mentioned parameters.

Binary requires Java 1.6

[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

String concatenation

[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

Using an operator name as property name

[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)

SimpleResolver does not handle Lists

[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.

Bug in AstIdentifierNode.setValue(...)

[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.

Can't resolve method 'startsWith' in class java.lang.String

[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

Binary requires Java 1.6

[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

BeanELResolver should use Method.setAccessible(true)

[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).

Evaluation of second operand in condition

[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

String concatenation

[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

Bug in AstIdentifierNode.setValue(...)

[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.

Checks in TreeMethodExpression are too restrictive

[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.

Checks in TreeMethodExpression are too restrictive

[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.

SimpleContext.getVariableMapper() returns null

[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.

Using an operator name as property name

[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)

SimpleContext.getVariableMapper() returns null

[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.

Resolving of array index

[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

BeanELResolver should use Method.setAccessible(true)

[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).

BeanELResolver should use Method.setAccessible(true)

[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).

SimpleResolver does not handle Lists

[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.

Bug in AstIdentifierNode.setValue(...)

[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.

Binary requires Java 1.6

[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

Function namespace required by SimpleContext but not in spec

[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.

Resolving of array index

[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

SimpleResolver does not handle Lists

[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.

Bug in AstIdentifierNode.setValue(...)

[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.

Using an operator name as property name

[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)

Binary requires Java 1.6

[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

Resolving of array index

[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

Can't resolve method 'startsWith' in class java.lang.String

[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

Using an operator name as property name

[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)

Bug in ExpressionFactory.createMethodExpression() ?

[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

{controller.createAddress(addr.street, addr.postalCode, addr.city)}

with null values for the above mentioned parameters.

Evaluation of second operand in condition

[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

Can't resolve method 'startsWith' in class java.lang.String

[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

Evaluation of second operand in condition

[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

Can't resolve method 'startsWith' in class java.lang.String

[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

Resolving of array index

[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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.