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: CAMEL-11216: REST-DSL - Producer fails with NPE or other exceptions if you have not set a hostname
Date Tue, 23 May 2017 09:12:59 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.19.x 743849aa2 -> 69e40893c
  refs/heads/master 9a54dcc13 -> 045a23054


CAMEL-11216: REST-DSL - Producer fails with NPE or other exceptions if you have not set a
hostname


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

Branch: refs/heads/master
Commit: 045a23054e266df6ae09c17744d240012938b83c
Parents: 9a54dcc
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue May 23 10:02:04 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue May 23 10:02:04 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/rest/RestEndpoint.java     | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/045a2305/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
index 73bccf9..5518a10 100644
--- a/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
@@ -270,6 +270,12 @@ public class RestEndpoint extends DefaultEndpoint {
 
     @Override
     public Producer createProducer() throws Exception {
+        if (ObjectHelper.isEmpty(host)) {
+            // hostname must be provided
+            throw new IllegalArgumentException("Hostname must be configured on either restConfiguration"
+                + " or in the rest endpoint uri as a query parameter with name host, eg rest:"
+ method + ":" + path + "?host=someserver");
+        }
+
         RestProducerFactory apiDocFactory = null;
         RestProducerFactory factory = null;
 


Mime
View raw message