Hi, I just did a quick test on camel trunk, I cannot reproduce the error that you get. You can check out the unit test here[1].
[1]https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSimpleRouteWhenTest.java -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Friday, November 16, 2012 at 2:07 PM, liugang wrote: > Hi All: > > > I have following codes: > > intercept().process(new Processor() { > > > public void process(Exchange > exchange) throws Exception { > > System.out.println("Intercept without condition"); > > } > > }).when(simple("${in.body} == > 'a'")).process(new Processor() { > > > public void process(Exchange > exchange) throws Exception { > > System.out.println("Intercept when body equals 'a'"); > > } > > }); > > from("timer:foo?repeatCount=1").setBody(constant("b")).process( > > new Processor() { > > > public void > process(Exchange exchange) > > throws Exception { > > System.out.println(exchange.getIn().getBody( > > String.class)); > > } > > }); > > > The result is: > > > Intercept without condition > > Intercept when body equals 'a' > > Intercept without condition > > Intercept when body equals 'a' > > b > > > But I think the correct one should be: > > > Intercept without condition > > Intercept without condition > > b > > > and if I move the when condition to next behind the intercept(), then it > works fine. > > > Does anybody can have a look, and check it's a Camel bug or not? > > > Thanks > > GangLiu