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 2023/06/23 14:53:40 UTC

[camel] 07/17: (chores) camel-hazelcast: do not catch Throwable

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 eab4e0cf524907970d4945543763be02e38c103f
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 23 14:42:53 2023 +0200

    (chores) camel-hazelcast: do not catch Throwable
---
 .../camel/component/hazelcast/seda/HazelcastSedaConsumer.java       | 4 ++--
 .../aggregate/hazelcast/HazelcastAggregationRepository.java         | 6 +++---
 .../hazelcast/ReplicatedHazelcastAggregationRepository.java         | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
index c58db47f288..a4528c5445c 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
@@ -133,13 +133,13 @@ public class HazelcastSedaConsumer extends DefaultConsumer implements Runnable {
                     LOG.debug("Hzlq Consumer Interrupted: {}", e, e);
                 }
                 continue;
-            } catch (Throwable e) {
+            } catch (Exception e) {
                 // Rollback
                 if (transactionCtx != null) {
                     LOG.trace("Rollback transaction: {}", transactionCtx.getTxnId());
                     try {
                         transactionCtx.rollbackTransaction();
-                    } catch (Throwable ignore) {
+                    } catch (Exception ignore) {
                     }
                 }
                 getExceptionHandler().handleException("Error processing exchange", exchange, e);
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
index 3617d63717d..db4325b3561 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
@@ -382,14 +382,14 @@ public class HazelcastAggregationRepository extends ServiceSupport
                             key);
                     LOG.trace("Put an exchange with ID {} for key {} into a recoverable storage in a thread-safe manner.",
                             exchange.getExchangeId(), key);
-                } catch (Throwable throwable) {
+                } catch (Exception exception) {
                     tCtx.rollbackTransaction();
 
                     final String msg = String.format(
                             "Transaction with ID %s was rolled back for remove operation with a key %s and an Exchange ID %s.",
                             tCtx.getTxnId(), key, exchange.getExchangeId());
-                    LOG.warn(msg, throwable);
-                    throw new RuntimeCamelException(msg, throwable);
+                    LOG.warn(msg, exception);
+                    throw new RuntimeCamelException(msg, exception);
                 }
             } else {
                 cache.remove(key);
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/ReplicatedHazelcastAggregationRepository.java b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/ReplicatedHazelcastAggregationRepository.java
index 1c4d9c6105a..84ca8ca45d2 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/ReplicatedHazelcastAggregationRepository.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/ReplicatedHazelcastAggregationRepository.java
@@ -297,7 +297,7 @@ public class ReplicatedHazelcastAggregationRepository extends HazelcastAggregati
                             key);
                     LOG.trace("Put an exchange with ID {} for key {} into a recoverable storage in a thread-safe manner.",
                             exchange.getExchangeId(), key);
-                } catch (Throwable throwable) {
+                } catch (Exception throwable) {
                     tCtx.rollbackTransaction();
 
                     final String msg = String.format(