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 2022/07/27 13:13:45 UTC

[camel] branch camel-3.18.x updated: CAMEL-18288: camel-yaml-dsl - Try .. Catch did not work

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

davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new e35bcce4e84 CAMEL-18288: camel-yaml-dsl - Try .. Catch did not work
e35bcce4e84 is described below

commit e35bcce4e84db290b73bd30b386fb55b24a6e936
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jul 27 15:03:08 2022 +0200

    CAMEL-18288: camel-yaml-dsl - Try .. Catch did not work
---
 .../src/main/java/org/apache/camel/model/TryDefinition.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/TryDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/TryDefinition.java
index 5014bd34f5f..1908d3c0a10 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/TryDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/TryDefinition.java
@@ -214,9 +214,9 @@ public class TryDefinition extends OutputDefinition<TryDefinition> {
         if (!initialized) {
             initialized = true;
             outputsWithoutCatches = new ArrayList<>();
-            catchClauses = new ArrayList<>();
-            finallyClause = null;
-
+            if (catchClauses == null) {
+                catchClauses = new ArrayList<>();
+            }
             for (ProcessorDefinition<?> output : outputs) {
                 if (output instanceof CatchDefinition) {
                     catchClauses.add((CatchDefinition) output);
@@ -231,6 +231,13 @@ public class TryDefinition extends OutputDefinition<TryDefinition> {
                     outputsWithoutCatches.add(output);
                 }
             }
+            // initialize parent
+            for (CatchDefinition cd : catchClauses) {
+                cd.setParent(this);
+            }
+            if (finallyClause != null) {
+                finallyClause.setParent(this);
+            }
         }
     }
 }