This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 165076afc61 KAFKA-17390 Remove broker-list in GetOffsetShell (#16992)
165076afc61 is described below

commit 165076afc615bcc324a07aec07a22edb41ae94c7
Author: TaiJuWu <[email protected]>
AuthorDate: Fri Aug 30 00:16:21 2024 +0800

    KAFKA-17390 Remove broker-list in GetOffsetShell (#16992)
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 .../java/org/apache/kafka/tools/GetOffsetShell.java | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/tools/src/main/java/org/apache/kafka/tools/GetOffsetShell.java 
b/tools/src/main/java/org/apache/kafka/tools/GetOffsetShell.java
index 60b78acd22b..992bad3f98f 100644
--- a/tools/src/main/java/org/apache/kafka/tools/GetOffsetShell.java
+++ b/tools/src/main/java/org/apache/kafka/tools/GetOffsetShell.java
@@ -101,18 +101,13 @@ public class GetOffsetShell {
         private final OptionSpec<String> partitionsOpt;
         private final OptionSpec<String> timeOpt;
         private final OptionSpec<String> commandConfigOpt;
-        private final OptionSpec<String> effectiveBrokerListOpt;
+        private final OptionSpec<String> bootstrapServerOpt;
         private final OptionSpecBuilder excludeInternalTopicsOpt;
 
         public GetOffsetShellOptions(String[] args) throws TerseException {
             super(args);
 
-            OptionSpec<String> brokerListOpt = parser.accepts("broker-list", 
"DEPRECATED, use --bootstrap-server instead; ignored if --bootstrap-server is 
specified. The server(s) to connect to in the form HOST1:PORT1,HOST2:PORT2.")
-                    .withRequiredArg()
-                    .describedAs("HOST1:PORT1,...,HOST3:PORT3")
-                    .ofType(String.class);
-            OptionSpec<String> bootstrapServerOpt = 
parser.accepts("bootstrap-server", "REQUIRED. The server(s) to connect to in 
the form HOST1:PORT1,HOST2:PORT2.")
-                    .requiredUnless("broker-list")
+            bootstrapServerOpt = parser.accepts("bootstrap-server", "REQUIRED. 
The server(s) to connect to in the form HOST1:PORT1,HOST2:PORT2.")
                     .withRequiredArg()
                     .describedAs("HOST1:PORT1,...,HOST3:PORT3")
                     .ofType(String.class);
@@ -151,17 +146,11 @@ public class GetOffsetShell {
                 throw new TerseException(e.getMessage());
             }
 
-            if (options.has(bootstrapServerOpt)) {
-                effectiveBrokerListOpt = bootstrapServerOpt;
-            } else {
-                effectiveBrokerListOpt = brokerListOpt;
-            }
-
             CommandLineUtils.maybePrintHelpOrVersion(this, USAGE_TEXT);
 
-            CommandLineUtils.checkRequiredArgs(parser, options, 
effectiveBrokerListOpt);
+            CommandLineUtils.checkRequiredArgs(parser, options, 
bootstrapServerOpt);
 
-            String brokerList = options.valueOf(effectiveBrokerListOpt);
+            String brokerList = options.valueOf(bootstrapServerOpt);
 
             try {
                 ToolsUtils.validateBootstrapServer(brokerList);
@@ -207,7 +196,7 @@ public class GetOffsetShell {
         }
 
         public String effectiveBrokerListOpt() {
-            return options.valueOf(effectiveBrokerListOpt);
+            return options.valueOf(bootstrapServerOpt);
         }
 
         public boolean hasExcludeInternalTopicsOpt() {

Reply via email to