You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2024/11/04 10:26:24 UTC
(camel) 01/01: CAMEL-20199: camel-jetty - Propagate exception
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch CAMEL-20199/propagate-exception
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b566e85a3e7bb88754c59a179f23e8dd7cbaf68d
Author: Nicolas Filotto <ni...@qlik.com>
AuthorDate: Mon Nov 4 11:26:01 2024 +0100
CAMEL-20199: camel-jetty - Propagate exception
---
.../camel/component/jetty/JettyHttpComponent.java | 36 +++++++++++++---------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
index baa13924e82..92b9e2b6441 100644
--- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -312,13 +312,17 @@ public abstract class JettyHttpComponent extends HttpCommonComponent
JettyHttpEndpoint endpoint = (JettyHttpEndpoint) consumer.getEndpoint();
String connectorKey = getConnectorKey(endpoint);
- CONNECTORS.compute(connectorKey, (cKey, connectorRef) -> {
- try {
- return connect(consumer, endpoint, cKey, connectorRef);
- } catch (Exception e) {
- throw new RuntimeCamelException(e);
- }
- });
+ try {
+ CONNECTORS.compute(connectorKey, (cKey, connectorRef) -> {
+ try {
+ return connect(consumer, endpoint, cKey, connectorRef);
+ } catch (Exception e) {
+ throw new RuntimeCamelException(e);
+ }
+ });
+ } catch (RuntimeCamelException e) {
+ throw (Exception) e.getCause();
+ }
}
private ConnectorRef connect(
@@ -477,13 +481,17 @@ public abstract class JettyHttpComponent extends HttpCommonComponent
HttpCommonEndpoint endpoint = consumer.getEndpoint();
String connectorKey = getConnectorKey(endpoint);
- CONNECTORS.computeIfPresent(connectorKey, (cKey, connectorRef) -> {
- try {
- return disconnect(consumer, connectorRef);
- } catch (Exception e) {
- throw new RuntimeCamelException(e);
- }
- });
+ try {
+ CONNECTORS.computeIfPresent(connectorKey, (cKey, connectorRef) -> {
+ try {
+ return disconnect(consumer, connectorRef);
+ } catch (Exception e) {
+ throw new RuntimeCamelException(e);
+ }
+ });
+ } catch (RuntimeCamelException e) {
+ throw (Exception) e.getCause();
+ }
}
private ConnectorRef disconnect(HttpConsumer consumer, ConnectorRef connectorRef) throws Exception {