mirror of https://github.com/apache/nifi.git
NIFI-4436: Bug fixes
Signed-off-by: Matt Gilman <matt.c.gilman@gmail.com>
This commit is contained in:
parent
f48808b1f4
commit
416b86145f
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.nifi.registry.flow;
|
package org.apache.nifi.registry.flow;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
@ -58,8 +59,17 @@ public class StandardFlowRegistryClient implements FlowRegistryClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FlowRegistry addFlowRegistry(final String registryId, final String registryName, final String registryUrl, final String description) {
|
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();
|
final String uriScheme = uri.getScheme();
|
||||||
|
if (uriScheme == null) {
|
||||||
|
throw new IllegalArgumentException("The given Registry URL is not valid: " + registryUrl);
|
||||||
|
}
|
||||||
|
|
||||||
final FlowRegistry registry;
|
final FlowRegistry registry;
|
||||||
if (uriScheme.equalsIgnoreCase("http") || uriScheme.equalsIgnoreCase("https")) {
|
if (uriScheme.equalsIgnoreCase("http") || uriScheme.equalsIgnoreCase("https")) {
|
||||||
|
@ -70,16 +80,6 @@ public class StandardFlowRegistryClient implements FlowRegistryClient {
|
||||||
+ "Please populate NiFi's Keystore/Truststore properties or connect to a NiFi Registry over http instead of https.");
|
+ "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 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 = new RestBasedFlowRegistry(this, registryId, registryUrl, sslContext, registryName);
|
||||||
registry.setDescription(description);
|
registry.setDescription(description);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue