fvaleri commented on code in PR #13131: URL: https://github.com/apache/kafka/pull/13131#discussion_r1083709872
########## core/src/main/scala/kafka/utils/ToolsUtils.scala: ########## @@ -64,4 +65,18 @@ object ToolsUtils { println(s"%-${maxLengthOfDisplayName}s : $specifier".format(metricName, value)) } } + + /** + * This is a simple wrapper around `CommandLineUtils.printUsageAndDie`. + * It is needed for tools migration (KAFKA-14525), as there is no Java equivalent for return type `Nothing`. + * Can be removed once [[kafka.admin.ConsumerGroupCommand]], [[kafka.tools.ConsoleConsumer]] + * and [[kafka.tools.ConsoleProducer]] are migrated. + * + * @param parser Command line options parser. + * @param message Error message. + */ + def printUsageAndDie(parser: OptionParser, message: String): Nothing = { Review Comment: In the original code we always call exit, as the method name implies, so I think it's fine. ########## core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala: ########## @@ -801,15 +801,21 @@ object ConsumerGroupCommand extends Logging { partitionsToReset.map { topicPartition => logStartOffsets.get(topicPartition) match { case Some(LogOffsetResult.LogOffset(offset)) => (topicPartition, new OffsetAndMetadata(offset)) - case _ => CommandLineUtils.printUsageAndDie(opts.parser, s"Error getting starting offset of topic partition: $topicPartition") + case _ => { + CommandLineUtils.printUsageAndDie(opts.parser, s"Error getting starting offset of topic partition: $topicPartition") + Exit.exit(1) Review Comment: Yes, there were some some replacements that I missed. Fixed. -- 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