Closed nitay closed 7 years ago
I ran into this as well. I wanted to show help when the parser thrown an exception, so I tried this:
try
{
parser.parse(args).run();
}
catch (Exception e)
{
new Help().run();
}
The result was:
Exception in thread "main" java.lang.NullPointerException at io.airlift.airline.GlobalUsageSummary.usage(GlobalUsageSummary.java:63) at io.airlift.airline.GlobalUsageSummary.usage(GlobalUsageSummary.java:52) at io.airlift.airline.Help.help(Help.java:57) at io.airlift.airline.Help.help(Help.java:50) at io.airlift.airline.Help.run(Help.java:25) at org.musetest.commandline.Launcher.main(Launcher.java:34)
So far this is all I have. Will update with more details / simpler reproducable example
public static void main(String[] args) throws Exception { Cli.CliBuilder builder = Cli.builder("hio")
.withDefaultCommand(Help.class)
.withCommands(Help.class,
InputBenchmarkCmd.class,
TailerCmd.class,
ConfOptionsCmd.class);
Cli cli = builder.build();
cli.parse(args).run();
}
nitayj@nitay-fb hive-io-3 (h3|● 6✚ 36) $ java -jar hive-io-exp-cmdline/target/hive-io-exp-cmdline-0.8-SNAPSHOT-jar-with-dependencies.jar help Exception in thread "main" java.lang.NullPointerException at io.airlift.command.UsagePrinter.appendWords(UsagePrinter.java:105) at io.airlift.command.GlobalUsageSummary.usage(GlobalUsageSummary.java:73) at io.airlift.command.GlobalUsageSummary.usage(GlobalUsageSummary.java:52) at io.airlift.command.Help.help(Help.java:45) at io.airlift.command.Help.help(Help.java:38) at io.airlift.command.Help.run(Help.java:25) at com.facebook.hiveio.cmdline.Main.main(Main.java:34)