diff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java index 090339e2382..14b637e8e18 100755 --- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java +++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java @@ -450,7 +450,7 @@ public static String getOptionWithDeprecatedAndDefault( // TODO: SOLR-17429 - remove the custom logic when Commons CLI is upgraded and // makes stderr the default, or makes Option.toDeprecatedString() public. - private static void deprecatedHandlerStdErr(Option o) { + public static void deprecatedHandlerStdErr(Option o) { // Deprecated options without a description act as "stealth" options if (o.isDeprecated() && !o.getDeprecated().getDescription().isBlank()) { final StringBuilder buf = diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java b/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java index 5097679e61a..4e9906f5217 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java @@ -29,7 +29,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; -import java.util.Locale; import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -163,7 +162,7 @@ public static void main(String[] args) CommandLineParser parser = DefaultParser.builder() // Override deprecation handler since the default one prints to stdout, we want stderr - .setDeprecatedHandler(o -> System.err.println(toDeprecatedString(o))) + .setDeprecatedHandler(SolrCLI::deprecatedHandlerStdErr) .build(); Options options = new Options(); @@ -722,14 +721,6 @@ public static void main(String[] args) } } - // TODO: Override toDeprecatedString since Option.toDeprecatedString has private visibility in - // Commons-CLI - private static String toDeprecatedString(Option o) { - return o.isDeprecated() - ? String.format(Locale.ROOT, "Option '%s': %s", o.getArgName(), o.getDeprecated()) - : ""; - } - private static boolean shouldCompressData( byte[] data, String path, int minStateByteLenForCompression) { if (path.endsWith("state.json")