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:15:24 UTC
[camel] branch camel-3.20.x 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 camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.20.x by this push:
new 0a51ab29184 CAMEL-19996 avoid NPE when handling exception without coordinator (#11733)
0a51ab29184 is described below
commit 0a51ab291844e29031fb7ba93a92af02bb74b86d
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 2e0354de516..a9acf56b73f 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);