camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: rest-dsl parameter name is mandatory - avoid potential NPE
Date Wed, 01 Jul 2015 09:01:01 GMT
Repository: camel
Updated Branches:
  refs/heads/master 65594b370 -> f276180b7


rest-dsl parameter name is mandatory - avoid potential NPE


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

Branch: refs/heads/master
Commit: 65c9d9a1b2bb78f21132080cc68d011bf9586510
Parents: 65594b3
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jul 1 10:32:28 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 1 10:39:17 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/model/rest/RestDefinition.java | 2 ++
 .../org/apache/camel/model/rest/RestOperationParamDefinition.java | 3 +++
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/65c9d9a1/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index acbcf56..3331408 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -577,6 +577,8 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
                     //  merge if exists
                     boolean found = false;
                     for (RestOperationParamDefinition param : verb.getParams()) {
+                        // name is mandatory
+                        ObjectHelper.notEmpty(param.getName(), "parameter name");
                         if (param.getName().equalsIgnoreCase(key)) {
                             param.type(RestParamType.path);
                             found = true;

http://git-wip-us.apache.org/repos/asf/camel/blob/65c9d9a1/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
b/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
index ea379d6..82dcffd 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
@@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * To specify the rest operation parameters using Swagger.
@@ -275,6 +276,8 @@ public class RestOperationParamDefinition {
      * Ends the configuration of this parameter
      */
     public RestDefinition endParam() {
+        // name is mandatory
+        ObjectHelper.notEmpty(name, "name");
         verb.getParams().add(this);
         return verb.getRest();
     }


Mime
View raw message