camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (CAMEL-1144) Exceptions thrown from converters are not correctly handled
Date Thu, 04 Dec 2008 10:50:05 GMT

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

Claus Ibsen reassigned CAMEL-1144:
----------------------------------

    Assignee: Claus Ibsen

> Exceptions thrown from converters are not correctly handled
> -----------------------------------------------------------
>
>                 Key: CAMEL-1144
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1144
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.5.0
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>            Priority: Critical
>             Fix For: 1.5.1, 2.0.0
>
>
> Related nabble: http://www.nabble.com/Handling-converter-failure-td20830148s22882.html
> When an exception is thrown from a @Converter it is not correctly handled by onException.
 The handler is receiving a RuntimeCamelException and not checking the cause when determining
the best handler.
> {code}
> /////Converter
> @Converter
> public static LocalDateTime toLocalDateTime(final Object localDateTime)
> {
>   System.out.println("Converting to local date time");
>   throw new IllegalArgumentException("Bad data");
> }
> /////Routes
> Routes routes = new RouteBuilder() {
>   @Override
>   public void configure() throws Exception {
>     onException(IllegalArgumentException.class).handled(true).to("mock:exception");
>     from("direct:test").convertBodyTo(LocalDateTime.class).to("mock:end");
>   }
> };
> /////Test
> MockEndpoint endpoint = (MockEndpoint)
> camelContext.getEndpoint("mock:end");
> endpoint.expectedMessageCount(0);
> MockEndpoint endpoint2 = (MockEndpoint)
> camelContext.getEndpoint("mock:exception");
> endpoint2.expectedMessageCount(1);
> camelContext.createProducerTemplate().sendBody("direct:test", "test");
> endpoint.assertIsSatisfied();
> endpoint2.assertIsSatisfied();
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message