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:
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.
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
Most helpful comment
Okay, I'll create a pr later.