You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/01/12 14:46:34 UTC

(camel) 06/06: CAMEL-20297 camel-whatsapp: do not swallow interrupted exceptions

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

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

commit a70b6106c11269335643b60dc4ab7ed3da10b1e8
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jan 12 10:49:45 2024 +0100

    CAMEL-20297 camel-whatsapp: do not swallow interrupted exceptions
---
 .../component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java
index ef6d748f3a2..20bcb62d1b8 100644
--- a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java
@@ -99,7 +99,10 @@ public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
 
         try {
             handler.sendMessage(exchange, callback, message, authorizationToken);
-        } catch (IOException | InterruptedException e) {
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            throw new RuntimeCamelException("Could not send message " + message, e);
+        } catch (IOException e) {
             throw new RuntimeCamelException("Could not send message " + message, e);
         }
     }