Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][cli] Pulsar shell: fix custom commands execution #17479

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

nicoloboschi
Copy link
Contributor

Motivation

In Pulsar shell the custom commands don't work (PIP-201)

java.lang.NullPointerException: Cannot invoke "java.lang.Class.getConstructor(java.lang.Class[])" because the return value of "java.util.Map$Entry.getValue()" is null
        at org.apache.pulsar.admin.cli.PulsarAdminTool.addCommand(PulsarAdminTool.java:218)
        at org.apache.pulsar.admin.cli.PulsarAdminTool.setupCommands(PulsarAdminTool.java:164)
        at org.apache.pulsar.admin.cli.PulsarAdminTool.setupAndRun(PulsarAdminTool.java:224)
        at org.apache.pulsar.admin.cli.PulsarAdminTool.run(PulsarAdminTool.java:229)
        at org.apache.pulsar.shell.AdminShell.runCommand(AdminShell.java:72)
        at org.apache.pulsar.shell.PulsarShell.run(PulsarShell.java:436)
        at org.apache.pulsar.shell.PulsarShell.run(PulsarShell.java:220)
        at org.apache.pulsar.shell.PulsarShell.main(PulsarShell.java:209)

We just need to avoid the NPE because sometimes the setupCommands is called twice for prepare Pulsar shell commands for the autocompletion

Modifications

  • Avoid NPE

Verifying this change

Verify both autocompletion and execution work correctly

Documentation

  • doc-not-needed

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants