camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/9] camel git commit: Camel catalog - Improved validation error summary
Date Sun, 03 Jan 2016 14:28:25 GMT
Camel catalog - Improved validation error summary


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

Branch: refs/heads/master
Commit: 4b2732468f82362322fd3f39fe2844da42186a03
Parents: 467b3dc
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Jan 3 14:18:54 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Jan 3 14:18:54 2016 +0100

----------------------------------------------------------------------
 .../camel/catalog/EndpointValidationResult.java | 30 ++++++++++++++++----
 1 file changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4b273246/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
index 54c8b6a..5ae61b6 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java
@@ -23,6 +23,8 @@ import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 
+import static org.apache.camel.catalog.URISupport.isEmpty;
+
 /**
  * Details result of validating endpoint uri.
  */
@@ -271,26 +273,44 @@ public class EndpointValidationResult implements Serializable {
         }
         if (invalidReference != null) {
             for (Map.Entry<String, String> entry : invalidReference.entrySet()) {
-                if (!entry.getValue().startsWith("#")) {
+                boolean empty = isEmpty(entry.getValue());
+                if (empty) {
+                    options.put(entry.getKey(), "Empty reference value");
+                } else if (!entry.getValue().startsWith("#")) {
                     options.put(entry.getKey(), "Invalid reference value: " + entry.getValue()
+ " must start with #");
                 } else {
-                    options.put(entry.getKey(), "Invalid reference value: " + entry.getValue()
+ " must not be empty");
+                    options.put(entry.getKey(), "Invalid reference value: " + entry.getValue());
                 }
             }
         }
         if (invalidBoolean != null) {
             for (Map.Entry<String, String> entry : invalidBoolean.entrySet()) {
-                options.put(entry.getKey(), "Invalid boolean value: " + entry.getValue());
+                boolean empty = isEmpty(entry.getValue());
+                if (empty) {
+                    options.put(entry.getKey(), "Empty boolean value");
+                } else {
+                    options.put(entry.getKey(), "Invalid boolean value: " + entry.getValue());
+                }
             }
         }
         if (invalidInteger != null) {
             for (Map.Entry<String, String> entry : invalidInteger.entrySet()) {
-                options.put(entry.getKey(), "Invalid integer value: " + entry.getValue());
+                boolean empty = isEmpty(entry.getValue());
+                if (empty) {
+                    options.put(entry.getKey(), "Empty integer value");
+                } else {
+                    options.put(entry.getKey(), "Invalid integer value: " + entry.getValue());
+                }
             }
         }
         if (invalidNumber != null) {
             for (Map.Entry<String, String> entry : invalidNumber.entrySet()) {
-                options.put(entry.getKey(), "Invalid number value: " + entry.getValue());
+                boolean empty = isEmpty(entry.getValue());
+                if (empty) {
+                    options.put(entry.getKey(), "Empty number value");
+                } else {
+                    options.put(entry.getKey(), "Invalid number value: " + entry.getValue());
+                }
             }
         }
 


Mime
View raw message