Description
Karaf shell fails if you run this command:
a=shell:new java.util.ArrayList 2 2016-09-02 11:15:51,525 | ERROR | nsole user karaf | ShellUtil | 43 - org.apache.karaf.shell.core - 4.0.6 | Exception caught while executing command java.lang.IllegalStateException at org.apache.karaf.shell.support.converter.GenericType.parametersOf(GenericType.java:161)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.support.converter.GenericType.[init](GenericType.java:53)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.support.converter.GenericType.parametersOf(GenericType.java:154)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.support.converter.GenericType.[init](GenericType.java:53)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.commands.impl.NewAction.findMatchingConstructors(NewAction.java:167)[41:org.apache.karaf.shell.commands:4.0.6] at org.apache.karaf.shell.commands.impl.NewAction.execute(NewAction.java:89)[41:org.apache.karaf.shell.commands:4.0.6] at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[43:org.apache.karaf.shell.core:4.0.6] at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:274)[43:org.apache.karaf.shell.core:4.0.6] at java.lang.Thread.run(Thread.java:745)[:1.8.0_102]
The reason for that is not really that it can't handle generics but it the logic that probe for the best matching constructor, that at some point, in this class:
sees type set to "? extends E" that is not able to handle, thus throwing the blocking exception.
It's enough to replace that exception with an empty return, to bypass the failing iteration and have the command to succeed.
Attachments
Issue Links
- links to