Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.13.1
-
None
-
Unknown
Description
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:
MyClass.java
public class MyClass { public Object[] getMyArray() { return new Object[]{"Hallo", "World", "!"}; } }
Accessing the property myArray with Simple:
<setHeader headerName="mySimpleHeader"> <simple>body.myArray.length</simple> </setHeader> <log message="mySimpleHeader = ${header.mySimpleHeader}" />
Java:
final ProducerTemplate template = main.getCamelTemplate(); template.sendBody("direct:start", new MyClass());
Log:
[main] route1 INFO mySimpleHeader = 1
The return value should be 3 instead of 1.