You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2015/01/04 09:03:34 UTC

[jira] [Assigned] (CAMEL-8005) Simple language produces null for a method call on a header value

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

Willem Jiang reassigned CAMEL-8005:
-----------------------------------

    Assignee: Willem Jiang

> 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
>            Assignee: Willem Jiang
>
> 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)