Skip to content

Make appendTable(null) a no-op - #455

Open
SonicHedghog wants to merge 1 commit into
apache:masterfrom
SonicHedghog:patch-append-table-null
Open

SonicHedghog wants to merge 1 commit into
apache:masterfrom
SonicHedghog:patch-append-table-null

Conversation

@SonicHedghog

Copy link
Copy Markdown

HelpAppendable.appendTable documents that a null TableDefinition is a no-op. TextHelpAppendable does not implement that contract: it passes null into adjustTableFormat and throws a NullPointerException.

Reproducer against 1.11.0 and current master:

new TextHelpAppendable(new StringWriter()).appendTable(null);

Actual result: NullPointerException.

Expected result: no output and no exception, consistent with the interface contract and with the existing null handling of appendTitle and appendParagraph.

This change returns immediately when the table definition is null. The regression test in TextHelpAppendableTest fails without the production change and passes with it.

Verification: the default Maven build (mvn) passes locally.

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? Devin prepared the change, regression test, commit, and this description under human direction.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

Return without writing output when the table definition is null, as
specified by HelpAppendable.

Assisted-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant