jsancio commented on code in PR #15986: URL: https://github.com/apache/kafka/pull/15986#discussion_r1615318177
########## raft/src/main/java/org/apache/kafka/raft/QuorumConfig.java: ########## @@ -199,6 +206,34 @@ private static Map<Integer, InetSocketAddress> parseVoterConnections( return voterMap; } + public static InetSocketAddress parseBootstrapServer(String bootstrapServer) { + String host = Utils.getHost(bootstrapServer); + if (host == null) { + throw new ConfigException( + String.format( + "Failed to parse host name from {} for the configuration {}. Each " + + "entry should be in the form \"{host}:{port}\"", + bootstrapServer, + QUORUM_BOOTSTRAP_SERVERS_CONFIG + ) + ); + } + + Integer port = Utils.getPort(bootstrapServer); + if (port == null) { + throw new ConfigException( + String.format( + "Failed to parse host port from {} for the configuration {}. Each " + + "entry should be in the form \"{host}:{port}\"", + bootstrapServer, + QUORUM_BOOTSTRAP_SERVERS_CONFIG + ) + ); + } + + return InetSocketAddress.createUnresolved(host, port); Review Comment: I am not sure. I know that it throws an `IllegalArgumentException` if host is `null` or port is outside the valid range. I think it is better for `Utils.getHost` and `Utils.getPort` to better catch invalid host and port values so we can throw the corresponding `ConfigException`. I filed https://issues.apache.org/jira/browse/KAFKA-16824 to improve the implementation of those methods. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org