[jira] Created: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
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
            Priority: Critical


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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47855#action_47855 ]

Claus Ibsen commented on CAMEL-1144:
------------------------------------

Just to give a workaround.

Use onException(Exception.class).onWhen(bean(IsThisTheExceptionIWant.class)) and implement the logic in your own POJO



> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Claus Ibsen updated CAMEL-1144:
-------------------------------

    Fix Version/s: 2.0.0
                   1.5.1

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47860#action_47860 ]

Claus Ibsen commented on CAMEL-1144:
------------------------------------

This new rule applies:
- If the thrown exception has a caused by then this exception is used for selection, if no match found the original exception is used for selection instead


I was wondering if we should do this cause by check for all the entire exception hierarchy starting from the bottom and then recurring up?

1) RuntimeCamelException
2) +IOException
3)    + FileNotFoundException

So Camel will start with (3) and then match up the tree until (1)

Currently we support tree level 1+2 but I guess we should support all levels and start from the bottom, the real cause!

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Work started: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Work on CAMEL-1144 started by 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47862#action_47862 ]

Claus Ibsen commented on CAMEL-1144:
------------------------------------

Okay got the tree fixed by introducing an iterator that walks the order we would like.

Other implementations could extend and use their own ordering.


    /**
     * Iterator that walks the exception hieracy in the order we should match.
     * <p/>
     * Will default walk from bottom upwards to the root exception
     */
    protected class ExceptionIterator implements Iterator<Throwable> {


> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47863#action_47863 ]

Claus Ibsen commented on CAMEL-1144:
------------------------------------

D:\project\camel\camel-core>svn commit --message "CAMEL-1144: DefaultExceptionPolicyStrategy now tests caused by exceptions (using bottom to top exception hieracy iterator)"
Sending        camel-core\src\main\java\org\apache\camel\processor\exceptionpolicy\DefaultExceptionPolicyStrategy.java
Adding         camel-core\src\test\java\org\apache\camel\processor\onexception\OnExceptionWrappedExceptionTest.java
Transmitting file data ..
Committed revision 723314.


> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47865#action_47865 ]

Claus Ibsen commented on CAMEL-1144:
------------------------------------

PS: I have updated the wiki at exception clause trying to explain how camel works when it select which onException to use.

section: Exception Policy
http://cwiki.apache.org/confluence/display/CAMEL/Exception+Clause

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Claus Ibsen resolved CAMEL-1144.
--------------------------------

    Resolution: Fixed

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-1144) Exceptions thrown from converters are not correctly handled

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47864#action_47864 ]

Claus Ibsen commented on CAMEL-1144:
------------------------------------

Committed revision 723319. in 1.5 branch

> 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.