Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD8BFC23F for ; Fri, 13 Apr 2012 14:40:37 +0000 (UTC) Received: (qmail 51522 invoked by uid 500); 13 Apr 2012 14:40:37 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 51503 invoked by uid 500); 13 Apr 2012 14:40:37 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 51471 invoked by uid 99); 13 Apr 2012 14:40:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 14:40:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 14:40:36 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 7CF5B369308 for ; Fri, 13 Apr 2012 14:40:16 +0000 (UTC) Date: Fri, 13 Apr 2012 14:40:16 +0000 (UTC) From: "Claus Ibsen (Resolved) (JIRA)" To: issues@camel.apache.org Message-ID: <2038727222.22204.1334328016513.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <847795990.16649.1334224167573.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (CAMEL-5167) onException policy within global context lost when error handler redefined within route context. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CAMEL-5167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen resolved CAMEL-5167. -------------------------------- Resolution: Fixed And as I told you we will make the DSL stricter in Camel 3.0, where we will enforce that you can only configure error handler in certain positions etc. We cannot make this changes in the DSL in the 2.x line as it will break the DSL contract for people. Error handlers and onException is configured in the *start* of the route. > onException policy within global context lost when error handler redefined within route context. > ------------------------------------------------------------------------------------------------ > > Key: CAMEL-5167 > URL: https://issues.apache.org/jira/browse/CAMEL-5167 > Project: Camel > Issue Type: Improvement > Affects Versions: 2.9.1 > Reporter: Radoslaw Szymanek > Assignee: Claus Ibsen > Fix For: 2.10.0 > > > This may as well be Camel feature (limitation of Java DSL), but I found no indications/warning that this is a feature in Camel book or web documentation. > The route is somewhat ill defined as local errorHandler should be placed before bean part, but maybe for those types of mistakes > it should not have this nasty side effects of loosing global onException policy, but at least complain during route creation (?). > Moreover, the route works properly if I remove global error handler, so it is rather nasty effect if route definition correctness depends on the existence of the global error handler definition. > If I move local errorHandler before bean part then the my test passes as the onException policy is triggered and works properly. > As soon as I redefine the error handler within a route the onException policy is no longer applicable for the route and the route propagates the exception back to the caller. > {code} > errorHandler(defaultErrorHandler().maximumRedeliveries(1)); > onException(NullPointerException.class).setOnRedelivery(new NullRegistrationDateProcessor()); > from("direct:toPropertyFile").routeId("registrationEntryToPropertyFile") > .setHeader(Exchange.FILE_NAME, simple("${body.firstname}.${body.surname}")) > .bean(RegistrationToPropertiesBean.class, "convert") > // Potential bug in Camel, if the same error handler like global is turned on then onException defined in global context will not be picked up. > .errorHandler(defaultErrorHandler().maximumRedeliveries(1)) > // the code above is working if no default handler was created for a global context. > .to("file://" + outFolder); > {code} -- 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