This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 30d34cb95ab SOLR-17442: Fix a errant deprecation of --debug and
properly look up --verbose (#2732)
30d34cb95ab is described below
commit 30d34cb95abb3979a65eb427230ad21584e3cb40
Author: Eric Pugh <[email protected]>
AuthorDate: Tue Oct 1 16:08:15 2024 -0400
SOLR-17442: Fix a errant deprecation of --debug and properly look up
--verbose (#2732)
getOpt and getLongOpt are not equivalent. getOpt only works if you have a
one letter version of a command, so use getLongOpt for the --verbose flag.
---
solr/core/src/java/org/apache/solr/cli/AssertTool.java | 11 ++++++++++-
solr/core/src/java/org/apache/solr/cli/SolrCLI.java | 11 +++--------
solr/core/src/java/org/apache/solr/cli/ToolBase.java | 2 +-
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/cli/AssertTool.java
b/solr/core/src/java/org/apache/solr/cli/AssertTool.java
index 73f9cc761b6..dabbe2aaa8d 100644
--- a/solr/core/src/java/org/apache/solr/cli/AssertTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/AssertTool.java
@@ -129,9 +129,18 @@ public class AssertTool extends ToolBase {
SolrCLI.OPTION_CREDENTIALS);
}
+ /**
+ * Returns 100 error code for a true "error", otherwise returns the number
of tests that failed.
+ * Otherwise, very similar to the parent runTool method.
+ *
+ * @param cli the command line object
+ * @return 0 on success, or a number corresponding to number of tests that
failed, or 100 for a
+ * Error
+ * @throws Exception if a tool failed, e.g. authentication failure
+ */
@Override
public int runTool(CommandLine cli) throws Exception {
- verbose = cli.hasOption(SolrCLI.OPTION_VERBOSE.getOpt());
+ verbose = cli.hasOption(SolrCLI.OPTION_VERBOSE.getLongOpt());
int toolExitStatus;
try {
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 34d09249a79..056a7792bb5 100755
--- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
@@ -147,17 +147,12 @@ public class SolrCLI implements CLIO {
.build();
public static final Option OPTION_VERBOSE =
- Option.builder("v")
+ Option.builder()
.longOpt("verbose")
- .deprecated(
- DeprecatedAttributes.builder()
- .setForRemoval(true)
- .setSince("9.8")
- .setDescription("Use --debug instead")
- .get())
.required(false)
.desc("Enable verbose command output.")
.build();
+
public static final Option OPTION_HELP =
Option.builder("h").longOpt("help").required(false).desc("Print this
message.").build();
@@ -320,7 +315,7 @@ public class SolrCLI implements CLIO {
}
public static void raiseLogLevelUnlessVerbose(CommandLine cli) {
- if (!cli.hasOption(SolrCLI.OPTION_VERBOSE.getOpt())) {
+ if (!cli.hasOption(SolrCLI.OPTION_VERBOSE.getLongOpt())) {
StartupLoggingUtils.changeLogLevel("WARN");
}
}
diff --git a/solr/core/src/java/org/apache/solr/cli/ToolBase.java
b/solr/core/src/java/org/apache/solr/cli/ToolBase.java
index 715134a9fc4..d35b63e1528 100644
--- a/solr/core/src/java/org/apache/solr/cli/ToolBase.java
+++ b/solr/core/src/java/org/apache/solr/cli/ToolBase.java
@@ -50,7 +50,7 @@ public abstract class ToolBase implements Tool {
@Override
public int runTool(CommandLine cli) throws Exception {
- verbose = cli.hasOption(SolrCLI.OPTION_VERBOSE.getOpt());
+ verbose = cli.hasOption(SolrCLI.OPTION_VERBOSE.getLongOpt());
int toolExitStatus = 0;
try {