You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Hans Orbaan (JIRA)" <ji...@apache.org> on 2015/06/15 10:24:00 UTC

[jira] [Updated] (CAMEL-8871) null body after exception from transform method

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

Hans Orbaan updated CAMEL-8871:
-------------------------------
    Attachment: ExceptionToErrorRouteTest.java

CamelTestSupport test that shows the difference between exception from different calls. I would expect both tests to succeed and both methods to show the same exception behavior.

> null body after exception from transform method
> -----------------------------------------------
>
>                 Key: CAMEL-8871
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8871
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.15.2
>            Reporter: Hans Orbaan
>            Priority: Critical
>         Attachments: ExceptionToErrorRouteTest.java
>
>
> When an exception is thrown from a transform method I lose the content of the message body. This behaviour is unexpected because it does not happen when an exception is thrown from a bean call.
> .bean(ErrorBean.class, ErrorBean.METHOD)
> Vs.
> .transform().method(ErrorBean.class, ErrorBean.METHOD)
> I have a testcase that I will try to get attached but here are the routes:
> {code:java}
> if ("testTransformExceptionToErrorRoute".equals(getTestMethodName())) {
>                     from(START)
>                     .routeId("exception.test.transform")
>                     .transform().method(ErrorBean.class, ErrorBean.METHOD)
>                     .to(END);
>                 } else {
>                     from(START)
>                     .routeId("exception.test.bean")
>                     .bean(ErrorBean.class, ErrorBean.METHOD)
>                     .to(END);
>                 }
>     public static class ErrorBean {
>         private static final String METHOD = "throwException";
>         public static void throwException(Exchange exchange) {
>             String body = exchange.getIn().getBody(String.class);
>             Assertions.assertThat(body).isEqualTo(BODY);
>             throw new AssertionError();
>         }
>     }
> {code}



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