[
https://issues.apache.org/jira/browse/CAMEL-7478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14019496#comment-14019496
]
Willem Jiang commented on CAMEL-7478:
-------------------------------------
Applied the patch into camel master, camel-2.13.x and camel-2.12.x branches.
> Simple Language - Length of array properties is not correctly evaluated
> -----------------------------------------------------------------------
>
> Key: CAMEL-7478
> URL: https://issues.apache.org/jira/browse/CAMEL-7478
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.13.1
> Reporter: Peter Keller
> Assignee: Willem Jiang
> Fix For: 2.12.4, 2.13.2, 2.14.0
>
>
> If the exchange body is an array, then {{body.length}} returns correctly the
> length of the array. However, if the array is a property of an object, then
> not the correct value is returned:
> {code:title=MyClass.java}
> public class MyClass {
> public Object[] getMyArray() {
> return new Object[]{"Hallo", "World", "!"};
> }
> }
> {code}
> Accessing the property {{myArray}} with Simple:
> {code}
> <setHeader headerName="mySimpleHeader">
> <simple>body.myArray.length</simple>
> </setHeader>
> <log message="mySimpleHeader = ${header.mySimpleHeader}" />
> {code}
> Java:
> {code}
> final ProducerTemplate template = main.getCamelTemplate();
> template.sendBody("direct:start", new MyClass());
> {code}
> Log:
> {noformat}
> [main] route1 INFO mySimpleHeader = 1
> {noformat}
> The return value should be {{3}} instead of {{1}}.
--
This message was sent by Atlassian JIRA
(v6.2#6252)