You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2012/04/29 16:09:49 UTC

[jira] [Resolved] (CAMEL-5156) simple language is not working in onException policy (for example retryWhile clause).

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

Claus Ibsen resolved CAMEL-5156.
--------------------------------

       Resolution: Not A Problem
    Fix Version/s: 2.10.0

This works as designed. When you work with a predicate with the Exchange you get the raw details. And some people want to access the exception using getException etc.
                
> simple language is not working in onException policy (for example retryWhile clause).
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5156
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5156
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.1
>            Reporter: Radoslaw Szymanek
>            Assignee: Claus Ibsen
>             Fix For: 2.10.0
>
>
> The bug was checked against 2.9.1 version of Camel. 
> The simple language expressions are not calculated properly within onException clause. 
> The route below only works as expected because I copy the the exchange and remove information about the exception. If the original exchange with exception information is used with simple language then the exception will be rethrown during (at the end?) the calculation of simple expression. 
> If I copy the exchange and remove the exception information then the unit tests are passing nicely and the file with proper content is created, so simple language expression can be calculated properly for the object being routed.
> {code}
> from("direct:toPropertyFileAvoidFixingUnfixable")
>             .onException(NullPointerException.class)
>             .onRedelivery(new NullRegistrationDateProcessor())
>             .handled(true)
>             .retryWhile(new Predicate() {
>                 public boolean matches(Exchange exchange) {
>                     Predicate composite = PredicateBuilder.and(PredicateBuilder.isNull(simple("${body?.getRegistrationDate}")),
>                             PredicateBuilder.isNotNull(simple("${body?.getBirthdate}")));
>                     // Exchange with exception will make computation of simple predicate fail.
>                     Exchange local = exchange.copy();
>                     local.setException(null);
>                     boolean result = composite.matches(local);
>                     return result;
>                 }
>             })
>             .end()
>             .setHeader(Exchange.FILE_NAME, simple("${body.firstname}.${body.surname}"))
>             .bean(RegistrationToPropertiesBean.class, "convert")
>             .to("file://" + outFolder);
> {code}
> It is related to the issue https://issues.apache.org/jira/browse/CAMEL-4513. My guess is that the problem is present for many other places where simple language can be used within onException part of the route definition. Not just retryWhile and custom predicate used within retryWhile. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira