You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/10/16 15:14:25 UTC
[camel] branch main updated: CAMEL-19996 avoid NPE when handling exception without coordinator (#11733)
This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 6dfd3ed7ac2 CAMEL-19996 avoid NPE when handling exception without coordinator (#11733)
6dfd3ed7ac2 is described below
commit 6dfd3ed7ac2d62b04eaa39bddf657913da35afb2
Author: Johannes Boßle <jo...@knowis.de>
AuthorDate: Mon Oct 16 17:14:16 2023 +0200
CAMEL-19996 avoid NPE when handling exception without coordinator (#11733)
Co-authored-by: Johannes Boßle <jb...@knowis.de>
---
.../java/org/apache/camel/processor/saga/SagaProcessor.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/saga/SagaProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/saga/SagaProcessor.java
index 73f17d35173..d7108dd95cc 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/saga/SagaProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/saga/SagaProcessor.java
@@ -76,10 +76,15 @@ public abstract class SagaProcessor extends DelegateAsyncProcessor implements Tr
AsyncCallback callback) {
if (this.completionMode == SagaCompletionMode.AUTO) {
if (exchange.getException() != null) {
- coordinator.compensate().whenComplete((done, ex) -> ifNotException(ex, exchange, callback, () -> {
- setCurrentSagaCoordinator(exchange, previousCoordinator);
+ if (coordinator != null) {
+ coordinator.compensate().whenComplete((done, ex) -> ifNotException(ex, exchange, callback, () -> {
+ setCurrentSagaCoordinator(exchange, previousCoordinator);
+ callback.done(false);
+ }));
+ } else {
+ // No coordinator available, so no saga available.
callback.done(false);
- }));
+ }
} else {
coordinator.complete().whenComplete((done, ex) -> ifNotException(ex, exchange, callback, () -> {
setCurrentSagaCoordinator(exchange, previousCoordinator);