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 07:46:01 UTC

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

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



##########
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:
       static

##########
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:
       NumberFormatException

##########
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:
       NumberFormatException




-- 
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