[
https://issues.apache.org/jira/browse/CAMEL-13158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Campbell updated CAMEL-13158:
----------------------------------
Affects Version/s: 2.23.1
Priority: Minor (was: Major)
Description:
I found one strange behavior when I added below to my route:
{code:java}
from(...)
.toD("headerEnricher"){code}
After some debugging with below unit test, I was able to find the culprit as
this line which is interpreting "headerEnricher" as if it is equivalent to
"header.Enricher" or "header[Enricher]"
[https://github.com/apache/camel/blob/camel-2.23.x/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java#L352]
{code:java}
@Test
public void testSimpleHeaderString() {
final Language lan = new DefaultCamelContext().resolveLanguage("simple");
final Expression exp = lan.createExpression("hederEnricher");
//Pass
Assert.assertEquals(exp.toString(), "hederEnricher");
final Expression exp2 = lan.createExpression("headerEnricher");
//Fail
Assert.assertEquals(exp2.toString(), "headerEnricher");
}
{code}
My thought is that the legacy syntax should not try to parse the header
expression unless it is followed by some kind of valid operator character like
. or ? or [
Component/s: camel-core
Summary: Unable to invoke beans starting with the string "header"
using toD (was: Unable to invoke beans starting with the string header")
> Unable to invoke beans starting with the string "header" using toD
> ------------------------------------------------------------------
>
> Key: CAMEL-13158
> URL: https://issues.apache.org/jira/browse/CAMEL-13158
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.23.1
> Reporter: Adam Campbell
> Priority: Minor
>
>
> I found one strange behavior when I added below to my route:
>
> {code:java}
> from(...)
> .toD("headerEnricher"){code}
>
> After some debugging with below unit test, I was able to find the culprit as
> this line which is interpreting "headerEnricher" as if it is equivalent to
> "header.Enricher" or "header[Enricher]"
> [https://github.com/apache/camel/blob/camel-2.23.x/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java#L352]
>
>
> {code:java}
> @Test
> public void testSimpleHeaderString() {
> final Language lan = new DefaultCamelContext().resolveLanguage("simple");
> final Expression exp = lan.createExpression("hederEnricher");
> //Pass
> Assert.assertEquals(exp.toString(), "hederEnricher");
> final Expression exp2 = lan.createExpression("headerEnricher");
> //Fail
> Assert.assertEquals(exp2.toString(), "headerEnricher");
> }
> {code}
>
> My thought is that the legacy syntax should not try to parse the header
> expression unless it is followed by some kind of valid operator character
> like . or ? or [
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)