Skip to content

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

Merged
Technoboy- merged 1 commit into
apache:masterfrom
nicoloboschi:pshell-custom-commands
Sep 7, 2022
Merged

Technoboy- merged 1 commit into
apache:masterfrom
nicoloboschi:pshell-custom-commands

Conversation

@nicoloboschi

Copy link
Copy Markdown
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