You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2022/01/17 11:51:18 UTC

[GitHub] [zookeeper] ruanwenjun commented on a change in pull request #1759: ZOOKEEPER-4381: Remove magic string in QuorumPeerConfig

ruanwenjun commented on a change in pull request #1759:
URL: https://github.com/apache/zookeeper/pull/1759#discussion_r785909249



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
##########
@@ -964,4 +1016,20 @@ private boolean parseBoolean(String key, String value) throws ConfigException {
                                       + ". Choose 'true' or 'false.'");
         }
     }
+
+    private int parseInt(String key, String value) throws ConfigException {

Review comment:
       Done, but I am little confused why we need to change this method to static? Right now, this is not used in a static method. Maybe for future?

##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
##########
@@ -964,4 +1016,20 @@ private boolean parseBoolean(String key, String value) throws ConfigException {
                                       + ". Choose 'true' or 'false.'");
         }
     }
+
+    private int parseInt(String key, String value) throws ConfigException {
+        try {
+            return Integer.parseInt(value);
+        } catch (Exception ex) {

Review comment:
       Done

##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
##########
@@ -964,4 +1016,20 @@ private boolean parseBoolean(String key, String value) throws ConfigException {
                                       + ". Choose 'true' or 'false.'");
         }
     }
+
+    private int parseInt(String key, String value) throws ConfigException {
+        try {
+            return Integer.parseInt(value);
+        } catch (Exception ex) {
+            throw new ConfigException(String.format("Invalid option %s for %s, Choose a Integer", key, value), ex);
+        }
+    }
+
+    private long parseLong(String key, String value) throws ConfigException {
+        try {
+            return Long.parseLong(value);
+        } catch (Exception ex) {

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org