[ 
https://issues.apache.org/jira/browse/CAMEL-13158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760471#comment-16760471
 ] 

Adam Campbell commented on CAMEL-13158:
---------------------------------------

I agree that this is resolved in the 3.0.0 branch, but I think that the syntax 
could be made more restrictive in the 2.24+ branch itself.

My reasoning is that the documentation never mentions "headerfoo" as valid 
syntax. As per the documentation, only e.g. "header.foo" would have to be 
supported by the legacy syntax.

[http://camel.apache.org/simple.html]

Alternatively, the headerfoo syntax could be included in the documentation, but 
I think it's important that reserved prefixes like "header*" or "headers*" are 
called out explicitly.

> 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
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.0.0
>
>
>  
> 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)

Reply via email to