Description
In Apache Karaf 3.0.0-SNAPSHOT shell treats sub-shell actions as commands, i.e. command line "config --help" lead to exception:
java.lang.NullPointerException
at org.apache.karaf.shell.commands.basic.DefaultActionPreparator.prepare(DefaultActionPreparator.java:73)
at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)
at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)
at org.apache.karaf.shell.console.commands.$BlueprintCommand1093027430.execute(Unknown Source)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:182)
at java.lang.Thread.run(Thread.java:662)
at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.doRun(ConsoleFactoryService.java:102)
at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3$1.run(ConsoleFactoryService.java:93)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:337)
at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.run(ConsoleFactoryService.java:91)
And worst thing is that this bug makes "ssh" command unusable because shell trying to execute "ssh" sub-shell action. This problem can be solved by using full command name "ssh:ssh", but this is impossible in case of derived shell commands, for example "instance:connect".
It seems shell should ignore sub-shell actions while resolving command with argument(s).