You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Carlo Dapor (JIRA)" <ji...@apache.org> on 2017/07/12 20:19:00 UTC

[jira] [Updated] (KARAF-5246) Karaf shell command crashes on tab-completion when quotes are used

     [ https://issues.apache.org/jira/browse/KARAF-5246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carlo Dapor updated KARAF-5246:
-------------------------------
    Summary: Karaf shell command crashes on tab-completion when quotes are used  (was: Karaf shell command crashed on tab-completion when quotes are used)

> Karaf shell command crashes on tab-completion when quotes are used
> ------------------------------------------------------------------
>
>                 Key: KARAF-5246
>                 URL: https://issues.apache.org/jira/browse/KARAF-5246
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 4.0.9
>            Reporter: Carlo Dapor
>
> Commands bail out when a starting quote preceed a tab-completion.
> E.g.:
> Type 
> {code:java}
> feature:install -s
> {code}
>  and hit the tab key, you are prompted with the question whether you want to see all 40+ completions.
> But if you type 
> {code:java}
> feature:install -s "  # also with a single quote, btw
> {code}
> and then hit the tab key, you see an error: {color:red}Error executing command: String index out of range: 21{color}
> The log shows:
>  
> {noformat}
> 2017-07-12 21:39:44,803 | ERROR | nsole user karaf | ShellUtil                        | 43 - org.apache.karaf.shell.core - 4.0.9 | Exception caught while executing command
> java.lang.StringIndexOutOfBoundsException: String index out of range: 21
> 	at java.lang.String.substring(String.java:1963)[:1.8.0_131]
> 	at org.apache.karaf.shell.support.parsing.GogoParser.value(GogoParser.java:300)[43:org.apache.karaf.shell.core:4.0.9]
> 	at org.apache.karaf.shell.support.parsing.GogoParser.messy(GogoParser.java:223)[43:org.apache.karaf.shell.core:4.0.9]
> 	at org.apache.karaf.shell.support.parsing.GogoParser.statement(GogoParser.java:195)[43:org.apache.karaf.shell.core:4.0.9]
> 	at org.apache.karaf.shell.support.parsing.DefaultParser.parse(DefaultParser.java:34)[43:org.apache.karaf.shell.core:4.0.9]
> 	at org.apache.karaf.shell.impl.console.parsing.CommandLineParser.buildCommandLine(CommandLineParser.java:56)[43:org.apache.karaf.shell.core:4.0.9]
> 	at org.apache.karaf.shell.impl.console.CompleterAsCompletor.complete(CompleterAsCompletor.java:42)[43:org.apache.karaf.shell.core:4.0.9]
> 	at jline.console.ConsoleReader.complete(ConsoleReader.java:3296)[9:jline:2.14.1]
> 	at jline.console.ConsoleReader.readLine(ConsoleReader.java:2636)[9:jline:2.14.1]
> 	at jline.console.ConsoleReader.readLine(ConsoleReader.java:2362)[9:jline:2.14.1]
> 	at jline.console.ConsoleReader.readLine(ConsoleReader.java:2350)[9:jline:2.14.1]
> 	at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.readAndParseCommand(ConsoleSessionImpl.java:373)[43:org.apache.karaf.shell.core:4.0.9]
> 	at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:269)[43:org.apache.karaf.shell.core:4.0.9]
> 	at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]
> {noformat}
> What I would like to achieve, actually is with a StringsCompleter that accepts say 4 constants ("CODE", "TIME", "RUN", "ERROR"), I'd like to get multiple completions in the end.
> In other words, I would like to be able to this:
> > cool-command --expr '({color:#14892c}CODE{color}="A34" and {color:#14892c}TIME{color}=60) or ({color:#14892c}RUN{color} > 10 and {color:#14892c}ERROR{color}="E517")'
> where each {color:#14892c}green{color} completion above I would tab-select as I type along.
> This is currently not possible.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)