Pulsar: Running commands pulsar-admin source localrun report class java.lang.NullPointerException: null

Created on 26 Jan 2019  路  3Comments  路  Source: apache/pulsar

Describe the bug
Running commands pulsar-admin source localrun report class java.lang.NullPointerException: null

$ /data/pulsar/pulsar/bin/pulsar-admin source localrun
class java.lang.NullPointerException: null

To Reproduce
Steps to reproduce the behavior:

  1. The latest master branch used
  2. Run pulsar-admin source localrun

Additional context
I found it was for this pull request https://github.com/apache/pulsar/pull/3429.
In the following function setupCommands, admin is null, causing class CmdTopics initialization failure:

PulsarAdmin admin = adminFactory.apply(adminBuilder);
for (Map.Entry<String, Class<?>> c : commandMap.entrySet()) {
    jcommander.addCommand(c.getKey(), c.getValue().getConstructor(PulsarAdmin.class).newInstance(admin));
}

In the function CmdTopics:

super("topics", admin);
// admin is null in the localrun mode
topics = admin.topics();

If constructing admin client in the localrun mode, localrun mode is useless. I don't know if I understand it correctly. The test code is as follows https://github.com/AmateurEvents/pulsar/commit/53948980b2dedf754a60ced9cb9e383eb9c8938b.

componenfunctions typbug

Most helpful comment

Okay, I'll create a pr later.

All 3 comments

Thanks @tuteng for point it out, Would you like to solve this issue?

Okay, I'll create a pr later.

This is addressed by #3456

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LvBay picture LvBay  路  3Comments

qmnonic picture qmnonic  路  3Comments

lynnmatrix picture lynnmatrix  路  3Comments

xinln picture xinln  路  3Comments

oliverisaac picture oliverisaac  路  3Comments