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 2016/01/07 21:26:18 UTC

[2/4] camel git commit: Camel catalog - Validate incapable parsing errors

Camel catalog - Validate incapable parsing errors


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c45bf0a0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c45bf0a0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c45bf0a0

Branch: refs/heads/master
Commit: c45bf0a02e73faab397bdb560425fb4502330ece
Parents: 22b54c0
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 21:25:30 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 21:25:30 2016 +0100

----------------------------------------------------------------------
 .../camel/catalog/DefaultCamelCatalog.java      | 21 ++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c45bf0a0/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index 735d88d..1e97a1f 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -745,19 +745,18 @@ public class DefaultCamelCatalog implements CamelCatalog {
         boolean lenientProperties;
         String scheme;
 
-        // skip uris that may start with a placeholder
-        if (uri.startsWith("{{")) {
-            result.addIncapable(uri);
-            return result;
-        }
-
         try {
             // parse the uri
             URI u = normalizeUri(uri);
             scheme = u.getScheme();
             String json = componentJSonSchema(scheme);
             if (json == null) {
-                result.addUnknownComponent(scheme);
+                // if the uri starts with a placeholder then we are also incapable of parsing it as we wasn't able to resolve the component name
+                if (uri.startsWith("{{")) {
+                    result.addIncapable(uri);
+                } else if (scheme != null) {
+                    result.addUnknownComponent(scheme);
+                }
                 return result;
             }
 
@@ -768,7 +767,13 @@ public class DefaultCamelCatalog implements CamelCatalog {
             rows = JSonSchemaHelper.parseJsonSchema("properties", json, true);
             properties = endpointProperties(uri);
         } catch (URISyntaxException e) {
-            result.addSyntaxError(e.getMessage());
+            if (uri.startsWith("{{")) {
+                // if the uri starts with a placeholder then we are also incapable of parsing it as we wasn't able to resolve the component name
+                result.addIncapable(uri);
+            } else {
+                result.addSyntaxError(e.getMessage());
+            }
+
             return result;
         }