IGNITE-5599 Added check that node URL is valid. Added warning about 
ignite-rest-http.


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: cff23a99b655bc353e93fee5b2d87c5f76ff8d7b
Parents: 3cd30f0
Author: vsisko <[email protected]>
Authored: Wed Jun 28 12:04:58 2017 +0700
Committer: Alexey Kuznetsov <[email protected]>
Committed: Wed Jun 28 12:04:58 2017 +0700

----------------------------------------------------------------------
 .../apache/ignite/console/agent/rest/RestExecutor.java  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cff23a99/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
----------------------------------------------------------------------
diff --git 
a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
 
b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
index bfeef58..52d37c4 100644
--- 
a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
+++ 
b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
@@ -92,14 +92,18 @@ public class RestExecutor {
                 AgentClusterDemo.tryStart().await();
             }
             catch (InterruptedException ignore) {
-                throw new IllegalStateException("Failed to execute request 
because of embedded node for demo mode is not started yet.");
+                throw new IllegalStateException("Failed to send request 
because of embedded node for demo mode is not started yet.");
             }
         }
 
         String url = demo ? AgentClusterDemo.getDemoUrl() : nodeUrl;
 
-        HttpUrl.Builder urlBuilder = HttpUrl.parse(url)
-            .newBuilder();
+        HttpUrl httpUrl = HttpUrl.parse(url);
+
+        if (httpUrl == null)
+            throw new IllegalStateException("Failed to send request because of 
node URL is invalid: " + url);
+
+        HttpUrl.Builder urlBuilder = httpUrl.newBuilder();
 
         if (path != null)
             urlBuilder.addPathSegment(path);
@@ -167,6 +171,8 @@ public class RestExecutor {
             return RestResult.fail(STATUS_FAILED, "Failed connect to node and 
execute REST command.");
         }
         catch (ConnectException ignore) {
+            log.warn("Please ensure that nodes have ignite-rest-http module in 
classpath (was copied from libs/optional to libs folder).");
+
             throw new ConnectException("Failed connect to node and execute 
REST command [url=" + urlBuilder + "]");
         }
     }

Reply via email to