CAMEL-11139: Catch throwable in other places and also in the consumer cache
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/33dd5eb6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/33dd5eb6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/33dd5eb6 Branch: refs/heads/camel-2.18.x Commit: 33dd5eb611fdd0bb4aad6e32433f231b5394f317 Parents: c52bca5 Author: Claus Ibsen <[email protected]> Authored: Wed Apr 12 20:57:41 2017 +0200 Committer: Claus Ibsen <[email protected]> Committed: Wed Apr 12 20:58:27 2017 +0200 ---------------------------------------------------------------------- .../src/main/java/org/apache/camel/impl/ConsumerCache.java | 4 ++-- .../src/main/java/org/apache/camel/impl/ProducerCache.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/33dd5eb6/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java index 20deb90..4cb8ef4 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java +++ b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java @@ -145,7 +145,7 @@ public class ConsumerCache extends ServiceSupport { LOG.debug("Released PollingConsumer: {} is stopped as consumer cache is full", endpoint); } ServiceHelper.stopAndShutdownService(pollingConsumer); - } catch (Exception ex) { + } catch (Throwable ex) { if (ex instanceof RuntimeCamelException) { throw (RuntimeCamelException)ex; } else { @@ -171,7 +171,7 @@ public class ConsumerCache extends ServiceSupport { try { answer = endpoint.createPollingConsumer(); answer.start(); - } catch (Exception e) { + } catch (Throwable e) { throw new FailedToCreateConsumerException(endpoint, e); } if (pooled && answer instanceof ServicePoolAware) { http://git-wip-us.apache.org/repos/asf/camel/blob/33dd5eb6/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java index bfd20f0..faa0f72 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java +++ b/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java @@ -320,7 +320,7 @@ public class ProducerCache extends ServiceSupport { doneSync -> asyncDispatchExchange(endpoint, producer, resultProcessor, finalExchange, producerCallback)); return false; - } catch (Exception e) { + } catch (Throwable e) { // populate failed so return innerExchange.setException(e); producerCallback.done(true); @@ -575,7 +575,7 @@ public class ProducerCache extends ServiceSupport { // add as service which will also start the service // (false => we and handling the lifecycle of the producer in this cache) getCamelContext().addService(answer, false); - } catch (Exception e) { + } catch (Throwable e) { throw new FailedToCreateProducerException(endpoint, e); }
