You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2018/01/08 18:14:30 UTC

[42/50] nifi git commit: NIFI-4436: Bug fixes

NIFI-4436: Bug fixes

Signed-off-by: Matt Gilman <ma...@gmail.com>


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

Branch: refs/heads/master
Commit: 416b86145f58210baf548d422865068faf7acf39
Parents: f48808b
Author: Mark Payne <ma...@hotmail.com>
Authored: Wed Dec 13 13:57:59 2017 -0500
Committer: Bryan Bende <bb...@apache.org>
Committed: Mon Jan 8 12:44:56 2018 -0500

----------------------------------------------------------------------
 .../flow/StandardFlowRegistryClient.java        | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/416b8614/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClient.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClient.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClient.java
index 4f98a2b..754646b 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClient.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/StandardFlowRegistryClient.java
@@ -18,6 +18,7 @@
 package org.apache.nifi.registry.flow;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -58,8 +59,17 @@ public class StandardFlowRegistryClient implements FlowRegistryClient {
 
     @Override
     public FlowRegistry addFlowRegistry(final String registryId, final String registryName, final String registryUrl, final String description) {
-        final URI uri = URI.create(registryUrl);
+        final URI uri;
+        try {
+            uri = new URI(registryUrl);
+        } catch (URISyntaxException e) {
+            throw new IllegalArgumentException("The given Registry URL is not valid: " + registryUrl);
+        }
+
         final String uriScheme = uri.getScheme();
+        if (uriScheme == null) {
+            throw new IllegalArgumentException("The given Registry URL is not valid: " + registryUrl);
+        }
 
         final FlowRegistry registry;
         if (uriScheme.equalsIgnoreCase("http") || uriScheme.equalsIgnoreCase("https")) {
@@ -72,16 +82,6 @@ public class StandardFlowRegistryClient implements FlowRegistryClient {
 
             registry = new RestBasedFlowRegistry(this, registryId, registryUrl, sslContext, registryName);
             registry.setDescription(description);
-        } else if (uriScheme.equalsIgnoreCase("http") || uriScheme.equalsIgnoreCase("https")) {
-            final SSLContext sslContext = SslContextFactory.createSslContext(nifiProperties, false);
-            if (sslContext == null && uriScheme.equalsIgnoreCase("https")) {
-                throw new IllegalStateException("Failed to create Flow Registry for URI " + registryUrl
-                    + " because this NiFi is not configured with a Keystore/Truststore, so it is not capable of communicating with a secure Registry. "
-                    + "Please populate NiFi's Keystore/Truststore properties or connect to a NiFi Registry over http instead of https.");
-            }
-
-            registry = new RestBasedFlowRegistry(this, registryId, registryUrl, sslContext, registryName);
-            registry.setDescription(description);
         } else {
             throw new IllegalArgumentException("Cannot create Flow Registry with URI of " + registryUrl
                 + " because there are no known implementations of Flow Registries that can handle URIs of scheme " + uriScheme);