Skip to content

fix(tools): fail fast on invalid configType in rocksDBConfigToJson command - #11133

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/rocksdb-config-invalid-type-npe
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/rocksdb-config-invalid-type-npe

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

Motivation

mqadmin rocksDBConfigToJson with a bad -t value printed an "Invalid configType" message and returned null from getConfigTypeList, but execution then continued with the null list: local mode threw a raw NullPointerException from Objects.requireNonNull, and rpc mode carried the null list into the export request sent to brokers.

Modifications

Throw a SubCommandException carrying the same message so the command aborts cleanly on an invalid -t value instead of failing later with an unrelated error.

Verification

Fail-before (new test, run against the unpatched code):

Tests run: 1, Failures: 1, Errors: 0 -- RocksDBConfigToJsonCommandTest#testInvalidConfigTypeFailsWithCleanError
java.lang.AssertionError: invalid configType must not surface as a NullPointerException

Pass-after:

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 -- RocksDBConfigToJsonCommandTest

…mmand

getConfigTypeList printed an "Invalid configType" message and returned
null; execution then continued with the null list, so local mode threw a
NullPointerException from Objects.requireNonNull and rpc mode carried the
null into the export request. Throw a SubCommandException with the same
message so the command aborts cleanly on a bad -t value.
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Clean fail-fast fix — throwing SubCommandException instead of returning null prevents the confusing NullPointerException downstream. The test explicitly verifies the NPE path is eliminated.


Automated review by github-manager-bot

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.

3 participants