Andy Bailey created CAMEL-8005:
----------------------------------

             Summary: Simple language produces null for a method call on a 
header value
                 Key: CAMEL-8005
                 URL: https://issues.apache.org/jira/browse/CAMEL-8005
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.14.0
         Environment: Linux apps4u 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 
21:39:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
            Reporter: Andy Bailey


Please could you confirm if this is a bug.

It works if the text is sent in the body but not if it is sent in a header.

I hope the test case is self explanatory.

-------

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;

public class CamelBug {

        public static void main(String[] args) throws Exception {
                  CamelContext camelContext = new DefaultCamelContext();
                camelContext.addRoutes(new RouteBuilder() {
                    @Override
                    public void configure() throws Exception {
                        from("direct:test").
                                //setBody(simple("body.replace('a','b')")).
                      setBody(simple("header[text].replace('a','b')")).
                            
                        to("mock:test");
                    }
                });
                camelContext.start();
                
camelContext.createProducerTemplate().sendBodyAndHeader("direct:test","","text","replace
 me");
                MockEndpoint mockEndpoint =
        camelContext.getEndpoint("mock:test", MockEndpoint.class);
                String replacedMessage =
        mockEndpoint.getExchanges().get(0).getIn().getBody(String.class);
                
                System.out.println(replacedMessage);//gives null
                //assertEquals("replbce me", replacedMessage); 
        }

}




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

Reply via email to