README Example throws NullPointerException for "cmd" - ParentCommand not injected? #1415
Labels
theme: integration
An issue or change related to integration with other frameworks, shells or operating systems
theme: shell
An issue or change related to interactive (JLine) applications
type: bug 🐛
type: doc 📘
Milestone
I compiled and ran the example from https://github.com/remkop/picocli/blob/master/picocli-shell-jline3/README.md
titled "JLine 3.16 and Picocli 4.4+ Example"
It gives the following error:
prompt> cmd
java.lang.NullPointerException
at picocli.shell.jline3.example.Example$MyCommand.run(Example.java:94)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at picocli.shell.jline3.PicocliCommands.invoke(PicocliCommands.java:283)
at org.jline.console.impl.SystemRegistryImpl.execute(SystemRegistryImpl.java:1128)
at org.jline.console.impl.SystemRegistryImpl.execute(SystemRegistryImpl.java:1173)
at picocli.shell.jline3.example.Example.main(Example.java:176)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:254)
at java.lang.Thread.run(Thread.java:748)
Here is my dependency tree:
sbay@VDXSPK85051532:/fov/lrf/shell 16:19 (master *+)$ mvn dependency:tree
[INFO] After Session Start
[INFO] Setting git.branch to 'SNAPSHOT'
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< nz.co.spark.ims.lrf:shell >----------------------
[INFO] Building Spark LRF Shell 0.1.16-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ shell ---
[INFO] nz.co.spark.ims.lrf:shell:jar:0.1.16-SNAPSHOT
[INFO] +- org.fusesource.jansi:jansi:jar:2.1.0:compile
[INFO] - info.picocli:picocli-shell-jline3:jar:4.6.1:compile
[INFO] +- info.picocli:picocli:jar:4.6.1:compile
[INFO] +- org.jline:jline:jar:3.17.1:compile
[INFO] - org.jline:jline-console:jar:3.17.1:compile
[INFO] +- org.jline:jline-builtins:jar:3.17.1:compile
[INFO] | - org.jline:jline-reader:jar:3.17.1:compile
[INFO] - org.jline:jline-style:jar:3.17.1:compile
[INFO] - org.jline:jline-terminal:jar:3.17.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.161 s
[INFO] Finished at: 2021-08-19T16:22:21+12:00
[INFO] ------------------------------------------------------------------------
sbay@VDXSPK85051532:/fov/lrf/shell 16:22 (master *+)$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
The text was updated successfully, but these errors were encountered: