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

davsclaus pushed a commit to branch worktree-snazzy-petting-map
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a5311e5553f6c883321e82fe1703520500ff9122
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jul 11 09:52:00 2026 +0200

    CAMEL-23985: camel-yaml-dsl - Add validation in Pipe handling for 
unsupported ref kinds, missing sink endpoint, and empty errorHandler
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../org/apache/camel/dsl/yaml/YamlRoutesBuilderLoader.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoader.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoader.java
index 197284b6cd11..de4298dc917b 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoader.java
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoader.java
@@ -520,7 +520,7 @@ public class YamlRoutesBuilderLoader extends 
YamlRoutesBuilderLoaderSupport {
 
                 // is there any error handler?
                 MappingNode errorHandler = asMappingNode(nodeAt(root, 
"/spec/errorHandler"));
-                if (errorHandler != null) {
+                if (errorHandler != null && 
!errorHandler.getValue().isEmpty()) {
                     // there are 5 different error handlers, which one is it
                     NodeTuple nt = errorHandler.getValue().get(0);
                     String ehName = asText(nt.getKeyNode());
@@ -530,6 +530,10 @@ public class YamlRoutesBuilderLoader extends 
YamlRoutesBuilderLoaderSupport {
                         // a sink is a dead letter queue
                         DeadLetterChannelDefinition dlcd = new 
DeadLetterChannelDefinition();
                         MappingNode endpoint = 
asMappingNode(nodeAt(nt.getValueNode(), "/endpoint"));
+                        if (endpoint == null) {
+                            throw new IllegalArgumentException(
+                                    "Pipe errorHandler sink must have an 
endpoint defined");
+                        }
                         String dlq = extractCamelEndpointUri(endpoint);
                         dlcd.setDeadLetterUri(dlq);
                         ehf = dlcd;
@@ -604,6 +608,12 @@ public class YamlRoutesBuilderLoader extends 
YamlRoutesBuilderLoaderSupport {
             uri = extractTupleValue(mn.getValue(), "name");
         } else {
             uri = extractTupleValue(node.getValue(), "uri");
+            if (uri == null && mn != null) {
+                String kind = extractTupleValue(mn.getValue(), "kind");
+                String apiVersion = extractTupleValue(mn.getValue(), 
"apiVersion");
+                throw new IllegalArgumentException(
+                        "Unsupported Pipe ref kind: " + kind + " (apiVersion: 
" + apiVersion + ")");
+            }
         }
 
         // properties

Reply via email to