NIFI-373: - Including a clearer message when the UI and cluster security properties are not inline.
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/b38d74a6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/b38d74a6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/b38d74a6 Branch: refs/heads/NIFI-632 Commit: b38d74a65f9f58e8a628c648ab48ee3c7cace0db Parents: 628e639 Author: Matt Gilman <[email protected]> Authored: Tue Jun 23 07:26:43 2015 -0400 Committer: Matt Gilman <[email protected]> Committed: Tue Jun 23 07:26:43 2015 -0400 ---------------------------------------------------------------------- .../org/apache/nifi/util/NiFiProperties.java | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b38d74a6/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java index 43f02ca..e25f5d6 100644 --- a/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java +++ b/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java @@ -233,8 +233,7 @@ public class NiFiProperties extends Properties { * obtained. * * @return the NiFiProperties object to use - * @throws RuntimeException - * if unable to load properties file + * @throws RuntimeException if unable to load properties file */ public static synchronized NiFiProperties getInstance() { if (null == instance) { @@ -794,7 +793,7 @@ public class NiFiProperties extends Properties { final String scheme = (rawScheme == null) ? "http" : rawScheme; final String host; - final int port; + final Integer port; if ("http".equalsIgnoreCase(scheme)) { // get host if (StringUtils.isBlank(getProperty(WEB_HTTP_HOST))) { @@ -804,6 +803,10 @@ public class NiFiProperties extends Properties { } // get port port = getPort(); + + if (port == null) { + throw new RuntimeException(String.format("The %s must be specified if running in a cluster with %s set to false.", WEB_HTTP_PORT, CLUSTER_PROTOCOL_IS_SECURE)); + } } else { // get host if (StringUtils.isBlank(getProperty(WEB_HTTPS_HOST))) { @@ -813,6 +816,10 @@ public class NiFiProperties extends Properties { } // get port port = getSslPort(); + + if (port == null) { + throw new RuntimeException(String.format("The %s must be specified if running in a cluster with %s set to true.", WEB_HTTPS_PORT, CLUSTER_PROTOCOL_IS_SECURE)); + } } return InetSocketAddress.createUnresolved(host, port); @@ -824,8 +831,7 @@ public class NiFiProperties extends Properties { * configured. No directories will be created as a result of this operation. * * @return database repository path - * @throws InvalidPathException - * If the configured path is invalid + * @throws InvalidPathException If the configured path is invalid */ public Path getDatabaseRepositoryPath() { return Paths.get(getProperty(REPOSITORY_DATABASE_DIRECTORY)); @@ -836,8 +842,7 @@ public class NiFiProperties extends Properties { * configured. No directories will be created as a result of this operation. * * @return database repository path - * @throws InvalidPathException - * If the configured path is invalid + * @throws InvalidPathException If the configured path is invalid */ public Path getFlowFileRepositoryPath() { return Paths.get(getProperty(FLOWFILE_REPOSITORY_DIRECTORY)); @@ -850,8 +855,7 @@ public class NiFiProperties extends Properties { * operation. * * @return file repositories paths - * @throws InvalidPathException - * If any of the configured paths are invalid + * @throws InvalidPathException If any of the configured paths are invalid */ public Map<String, Path> getContentRepositoryPaths() { final Map<String, Path> contentRepositoryPaths = new HashMap<>();
