camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-10386) simple language nullsafe expression fails on empty array
Date Fri, 14 Oct 2016 08:48:20 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-10386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-10386.
---------------------------------
    Resolution: Fixed
      Assignee: Claus Ibsen

Thanks for the PR

> simple language nullsafe expression fails on empty array
> --------------------------------------------------------
>
>                 Key: CAMEL-10386
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10386
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.17.3, 2.18.0
>            Reporter: Dmitriy Frolov
>            Assignee: Claus Ibsen
>            Priority: Trivial
>             Fix For: 2.18.1, 2.19.0
>
>
> limitation w/ simple language on the 1st index of an empty array with a nullsafe expression
 
> sample expression: ${in.body?.list[0].toString}
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method:
?.get('list')[0].toString on java.util.HashMap due to: java.lang.IndexOutOfBoundsException:
Index: 0, Size: 0 
>         at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:120)

>         at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:138)

>         at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:126)

>         at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:118)

>         at org.apache.camel.builder.ExpressionBuilder$40.evaluate(ExpressionBuilder.java:993)

>         at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)

>         at org.apache.camel.TestSupport.assertExpression(TestSupport.java:255) 
>         at org.apache.camel.ContextTestSupport.assertExpression(ContextTestSupport.java:314)

>         at org.apache.camel.LanguageTestSupport.assertExpression(LanguageTestSupport.java:62)

>         at org.apache.camel.LanguageTestSupport.assertExpression(LanguageTestSupport.java:69)

>         at org.apache.camel.language.simple.SimpleTest.testOGNLBodyEmptyList(SimpleTest.java:267)

>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

>         at java.lang.reflect.Method.invoke(Method.java:497) 
>         at junit.framework.TestCase.runTest(TestCase.java:176) 
>         at junit.framework.TestCase.runBare(TestCase.java:141) 
>         at org.apache.camel.TestSupport.runBare(TestSupport.java:58) 
>         at junit.framework.TestResult$1.protect(TestResult.java:122) 
>         at junit.framework.TestResult.runProtected(TestResult.java:142) 
>         at junit.framework.TestResult.run(TestResult.java:125) 
>         at junit.framework.TestCase.run(TestCase.java:129) 
>         at junit.framework.TestSuite.runTest(TestSuite.java:252) 
>         at junit.framework.TestSuite.run(TestSuite.java:247) 
>         at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)

>         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

>         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

> Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 
>         at java.util.ArrayList.rangeCheck(ArrayList.java:653) 
>         at java.util.ArrayList.get(ArrayList.java:429) 
>         at org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.lookupResult(BeanExpression.java:385)

>         at org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:334)

>         at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message