[ 
https://issues.apache.org/jira/browse/NIFI-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15389559#comment-15389559
 ] 

ASF GitHub Bot commented on NIFI-2253:
--------------------------------------

Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/704#discussion_r71884169
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/cluster/ZooKeeperClientConfig.java
 ---
    @@ -93,4 +101,42 @@ private static int getTimePeriod(final Properties 
properties, final String prope
                 return (int) FormatUtils.getTimeDuration(defaultValue, 
TimeUnit.MILLISECONDS);
             }
         }
    +
    +    /**
    +     * Takes a given connect string and splits it by ',' character. For 
each
    +     * split result trims whitespace then splits by ':' character. For each
    +     * secondary split if a single value is returned it is trimmed and 
then the
    +     * default zookeeper 2181 is append by adding ":2181". If two values 
are
    +     * returned then the second value is evaluated to ensure it contains 
only
    +     * digits and if not then the entry is skipped. If more than two 
values are
    +     * returned the entry is skipped. Each entry is trimmed and if empty 
the
    +     * entry is skipped. After all splits are cleaned then they are all 
appended
    +     * back together demarcated by "," and the full string is returned.
    +     *
    +     * @param connectString the string to clean
    +     * @return cleaned connect string guaranteed to be non null but could 
be
    +     * empty
    +     */
    +    public static String cleanConnectString(final String connectString) {
    +        final String nospaces = 
StringUtils.deleteWhitespace(connectString);
    +        final String hostPortPairs[] = StringUtils.split(nospaces, ",", 
100);
    +        final List<String> cleanedEntries = new 
ArrayList<>(hostPortPairs.length);
    +        for (final String pair : hostPortPairs) {
    +            final String pairSplits[] = StringUtils.split(pair, ":", 3);
    +            if (pairSplits.length > 2) {
    +                continue; //skip it
    --- End diff --
    
    In these cases, where we have received an invalid configuration, I would be 
much more inclined to throw an Exception than to simply ignore the value. At a 
minimum, I think we need to log a warning message indicating that we are 
skipping the value that the user provided us.


> zookeeper server cannot interpret "space" in ZK connection string, in 
> nifi.properties config file
> -------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-2253
>                 URL: https://issues.apache.org/jira/browse/NIFI-2253
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Haimo Liu
>            Assignee: Joseph Witt
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> ZK server cannot interpret space in the following connection string 
> (nifi.properties config file):
> nifi.zookeeper.connect.string=localhost:2181,localhost:2182,<space>localhost:2183
> in this case, multiple NIFI nodes will run in a standalone mode instead of 
> operating in a clustered mode.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to