Skip to content

Always include legacy client options in error output - #6502

Open
lbschanno wants to merge 1 commit into
apache:mainfrom
lbschanno:accumulo-6501
Open

Always include legacy client options in error output#6502
lbschanno wants to merge 1 commit into
apache:mainfrom
lbschanno:accumulo-6501

Conversation

@lbschanno

Copy link
Copy Markdown
Contributor

The ClientOpts class does not always include the names of legacy options in its error output when a user provides legacy options to the Accumulo client.

Make the following changes:

  • Break the legacy options in ClientOpts into individual properties that can be set by JCommander.
  • Add ClientOpts.getPopulatedLegacyOptions() which will return a set of all user-provided legacy options.
  • Update ClientOpts.validateArgs() to check for the presence of any legacy options, and include them in the error message.

Fixes #6501

I tested these changes on a running instance. Some examples:

~/src/accumulo-uno ⑂main* $ accumulo shell -u root -p secret
SLF4J(W): Class path contains multiple SLF4J providers.
SLF4J(W): Found provider [org.apache.logging.slf4j.SLF4JServiceProvider@1175e2db]
SLF4J(W): Found provider [ch.qos.logback.classic.spi.LogbackServiceProvider@36aa7bc2]
SLF4J(W): See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J(I): Actual provider is of type [org.apache.logging.slf4j.SLF4JServiceProvider@1175e2db]
Received options [-p]
Thread 'shell' died.
java.lang.IllegalArgumentException: The Client options -p have been dropped. Use accumulo-client.properties for any connection or token options. See '-c, --config-file' option.
	at org.apache.accumulo.core.cli.ClientOpts.validateArgs(ClientOpts.java:227)
	at org.apache.accumulo.core.cli.BaseKeywordExecutable.execute(BaseKeywordExecutable.java:51)
	at org.apache.accumulo.start.Main.lambda$execKeyword$1(Main.java:116)
	at java.base/java.lang.Thread.run(Thread.java:1583)
~/src/accumulo-uno ⑂main* $ accumulo shell -u root -p secret --debug
SLF4J(W): Class path contains multiple SLF4J providers.
SLF4J(W): Found provider [org.apache.logging.slf4j.SLF4JServiceProvider@1175e2db]
SLF4J(W): Found provider [ch.qos.logback.classic.spi.LogbackServiceProvider@36aa7bc2]
SLF4J(W): See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J(I): Actual provider is of type [org.apache.logging.slf4j.SLF4JServiceProvider@1175e2db]
Received options [-p, --debug]
Thread 'shell' died.
java.lang.IllegalArgumentException: The Client options -p --debug have been dropped. Use accumulo-client.properties for any connection or token options. See '-c, --config-file' option.
	at org.apache.accumulo.core.cli.ClientOpts.validateArgs(ClientOpts.java:227)
	at org.apache.accumulo.core.cli.BaseKeywordExecutable.execute(BaseKeywordExecutable.java:51)
	at org.apache.accumulo.start.Main.lambda$execKeyword$1(Main.java:116)
	at java.base/java.lang.Thread.run(Thread.java:1583)

The ClientOpts class does not always include the names of legacy options
in its error output when a user provides legacy options to the Accumulo
client.

Make the following changes:
- Break the legacy options in ClientOpts into individual properties that
  can be set by JCommander.
- Add `ClientOpts.getPopulatedLegacyOptions()` which will return a set
  of all user-provided legacy options.
- Update `ClientOpts.validateArgs()` to check for the presence of any
  legacy options, and include them in the error message.

Fixes apache#6501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClientOpts does not always include legacy option name in error output

1 participant