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 2704118F61 for ; Fri, 5 Feb 2016 15:01:40 +0000 (UTC) Received: (qmail 68261 invoked by uid 500); 5 Feb 2016 15:01:40 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 68214 invoked by uid 500); 5 Feb 2016 15:01:40 -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 68183 invoked by uid 99); 5 Feb 2016 15:01:39 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Feb 2016 15:01:39 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id D59832C14F7 for ; Fri, 5 Feb 2016 15:01:39 +0000 (UTC) Date: Fri, 5 Feb 2016 15:01:39 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (CAMEL-9558) DefaultErrorHandler logs despite "handled true" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-9558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen reassigned CAMEL-9558: ---------------------------------- Assignee: Claus Ibsen > DefaultErrorHandler logs despite "handled true" > ----------------------------------------------- > > Key: CAMEL-9558 > URL: https://issues.apache.org/jira/browse/CAMEL-9558 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.16.2 > Reporter: Andreas Siepert > Assignee: Claus Ibsen > > The *assumption* is that handled exceptions will not be propagated any further. > In version {{2.15.5}} the test code (from the camel-jetty page) runs fine - but since {{2.16.0}} the handled exception is propagated to the {{DefaultErrorHandler}} which causes ERROR logs for every handled exception. > I could not find a hint in the release notes - so I think it's a bug. > {code} > public class MyTest extends CamelTestSupport { > @Test > public void test() throws Exception { > // using httpclient 4.3.5 > CloseableHttpClient httpclient = HttpClients.createDefault(); > HttpGet httRequest = new HttpGet("http://127.0.0.1:7890/myserver"); > HttpResponse response = httpclient.execute(httRequest); > assertThat(response.getStatusLine().getStatusCode(), is(500)); > } > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > from("jetty://http://localhost:7890/myserver").tracing() > // use onException to catch all exceptions and return a custom reply message > .onException(Exception.class).handled(true) > // create a custom failure response > .transform(constant("Dude something went wrong")) > // we must remember to set error code 500 as handled(true) > // otherwise would let Camel thing its a OK response (200) > .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(500)).end() > // now just force an exception immediately > .throwException(new IllegalArgumentException("I cannot do this")); > } > }; > } > } > {code} > *References from the user-list* > http://camel.465427.n5.nabble.com/onException-block-in-camel-2-16-1-td5777019.html#a5777064 > http://camel.465427.n5.nabble.com/jetty-handled-true-not-working-as-before-td5776774.html -- This message was sent by Atlassian JIRA (v6.3.4#6332)