[
https://issues.apache.org/jira/browse/KARAF-5246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16354004#comment-16354004
]
ASF subversion and git services commented on KARAF-5246:
--------------------------------------------------------
Commit e637284031da0d8c8dc3e8ac2e8557928f0eaf00 in karaf's branch
refs/heads/master from [~gnt]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=e637284 ]
[KARAF-5246] The command parser should be more tolerant when parsing the line
during completion
> 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
> Priority: Major
>
> Commands bail out when a starting quote - single or double quote - preceedes
> 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
(v7.6.3#76005)