You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "maoling (Jira)" <ji...@apache.org> on 2020/02/17 02:30:00 UTC

[jira] [Commented] (ZOOKEEPER-3721) Making the boolean configuration parameters consistent

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

maoling commented on ZOOKEEPER-3721:
------------------------------------

[~ctest.team]

Zookeeper uses the github workflow. The contributor guideline
 is [here](https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute])

> Making the boolean configuration parameters consistent
> ------------------------------------------------------
>
>                 Key: ZOOKEEPER-3721
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3721
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.5.6
>            Reporter: Ctest
>            Priority: Major
>         Attachments: ZOOKEEPER-3721-000.patch
>
>
> *Description*
> The QuorumPeerConfig.java uses java built-in method
> {code:java}
> Boolean.parseBoolean(String value){code}
> to parse almost all boolean parameters. When the value is "true" (ignoring case), this method will return true. Otherwise, it will return false. It means all these boolean parameters can accept any string and translate it into false as long as it is not "true". 
> standaloneEnabled and reconfigEnabled are two exceptions because they only accept "true" or "false":
> {code:java}
> } else if (key.equals("standaloneEnabled")) {
>   if (value.toLowerCase().equals("true")) {
>     setStandaloneEnabled(true);
>   } else if (value.toLowerCase().equals("false")) {
>     setStandaloneEnabled(false);
>   } else {
>     throw new ConfigException("Invalid option "
>                               + value
>                               + " for standalone mode. Choose 'true' or 'false.'");
>   }{code}
>  
> *Improvement*
> To improve this part, I am trying to unify all these boolean parser methods and make them more robust. Generally, I wrote a parseBoolean which only accepts "true" or "false" in QuorumPeerConfig.java and use this method for parsing all boolean parameters.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)