[
https://issues.apache.org/jira/browse/CAMEL-10789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-10789:
-----------------------------------
Assignee: Claus Ibsen
> Indexing with simple expression broken in Apache Camel 2.18
> -----------------------------------------------------------
>
> Key: CAMEL-10789
> URL: https://issues.apache.org/jira/browse/CAMEL-10789
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.18.0, 2.18.1, 2.18.2
> Environment: Camel 2.18.0/2.18.1/2.18.2 with JDK 1.8.0_112
> Reporter: Surjit Sen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.18.3
>
>
> The following sample code works fine with version 2.17.4 (JDK 1.7), but fails
> on Camel 2.18.0, 2.18.1 and 2.18.2 (JDK 1.8)
> {code}
> from("direct:process")
> .process(new Processor() {
> public void process(Exchange exchange) {
> List<String> alist = new ArrayList<String>();
> alist.add("1");
> alist.add("99");
> exchange.getIn().setHeader("ITEMS", alist);
> exchange.getIn().setHeader("TOTAL_LOOPS", alist.size());
> }
> })
> .loop(simple("${header.TOTAL_LOOPS}", Integer.class))
> .setHeader("item",
> simple("${header.ITEMS[${property.CamelLoopIndex}]}", String.class))
> .log(LoggingLevel.INFO, LOG_CLASS_NAME, simple("item =
> ${header.item} and TOTAL_MAPS = ${header.TOTAL_LOOPS}").getText())
> .end()
> .end();
> {code}
> With 2.18.x, the following exception gets thrown:
> {code}
> 2017-02-03 21:13:31 ERROR DefaultErrorHandler:204 - Failed delivery for
> (MessageId: ID-CATL0W10D4DG4R1-55822-1486174410756-0-1 on ExchangeId:
> ID-CATL0W10D4DG4R1-55822-1486174410756-0-2). Exhausted after delivery
> attempt: 1 caught:
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: [${property.CamelLoopIndex}] on java.util.ArrayList due to:
> java.lang.IndexOutOfBoundsException: Key: ${property.CamelLoopIndex} not
> found in bean: [1, 99] of type: java.util.ArrayList using OGNL path
> [[${property.CamelLoopIndex}]]
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)