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 12:19:42 UTC

(camel) branch main updated: CAMEL-20199: camel-jetty - Propagate exception (#16149)

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 66fbdcd2c71 CAMEL-20199: camel-jetty - Propagate exception (#16149)
66fbdcd2c71 is described below

commit 66fbdcd2c71a6588bacd7b3e0d2a03128c0cd069
Author: Nicolas Filotto <es...@users.noreply.github.com>
AuthorDate: Mon Nov 4 13:19:36 2024 +0100

    CAMEL-20199: camel-jetty - Propagate exception (#16149)
---
 .../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 {