You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/03/30 17:14:56 UTC

[camel] branch main created (now 5f86fee)

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

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at 5f86fee  CAMEL-17806: camel-yaml-dsl - Better parser error with source loc:line of the problem

This branch includes the following new commits:

     new 5f86fee  CAMEL-17806: camel-yaml-dsl - Better parser error with source loc:line of the problem

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[camel] 01/01: CAMEL-17806: camel-yaml-dsl - Better parser error with source loc:line of the problem

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5f86fee43f9cfc2f2b58ace91b152108bbf02bed
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Mar 30 19:01:46 2022 +0200

    CAMEL-17806: camel-yaml-dsl - Better parser error with source loc:line of the problem
---
 .../org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java     | 4 ++--
 .../src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java   | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
index 21f0ed1..9ffd966 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
@@ -217,7 +217,7 @@ public class YamlDeserializerSupport {
                     answer.put(StringHelper.dashToCamelCase(key), asText(val));
                     break;
                 default:
-                    throw new UnsupportedNodeTypeException(node);
+                    throw new InvalidNodeTypeException(node, NodeType.SCALAR);
             }
         }
 
@@ -294,7 +294,7 @@ public class YamlDeserializerSupport {
     private static <T> void asCollection(Node node, Class<T> type, Collection<T> collection, boolean flat)
             throws YamlDeserializationException {
         if (node.getNodeType() != NodeType.SEQUENCE) {
-            throw new UnsupportedOperationException("Unable to parse no array node");
+            throw new InvalidNodeTypeException(node, NodeType.SEQUENCE);
         }
 
         YamlDeserializationContext dc = getDeserializationContext(node);
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
index a5c13bc..ec7cc6b 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
@@ -29,6 +29,7 @@ import org.apache.camel.Component;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.PropertyBindingException;
 import org.apache.camel.dsl.yaml.common.exception.InvalidEndpointException;
+import org.apache.camel.dsl.yaml.common.exception.InvalidNodeTypeException;
 import org.apache.camel.dsl.yaml.common.exception.UnsupportedFieldException;
 import org.apache.camel.dsl.yaml.common.exception.UnsupportedNodeTypeException;
 import org.apache.camel.model.RouteDefinition;
@@ -281,7 +282,7 @@ public final class YamlSupport {
                     if (val.getNodeType() == NodeType.SCALAR) {
                         parameters.put(StringHelper.dashToCamelCase(key), YamlDeserializerSupport.asText(val));
                     } else {
-                        throw new UnsupportedNodeTypeException(node);
+                        throw new InvalidNodeTypeException(node, NodeType.SCALAR);
                     }
                 }