You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Rico Neubauer (Jira)" <ji...@apache.org> on 2022/10/14 08:04:00 UTC

[jira] [Created] (KARAF-7580) StringIndexOutOfBoundsException in ShellTable

Rico Neubauer created KARAF-7580:
------------------------------------

             Summary: StringIndexOutOfBoundsException in ShellTable
                 Key: KARAF-7580
                 URL: https://issues.apache.org/jira/browse/KARAF-7580
             Project: Karaf
          Issue Type: Improvement
    Affects Versions: 4.4.1, 4.3.7
            Reporter: Rico Neubauer


Karaf commands that provide text with line breaks in their description can break the general {{help}} command and lead to exception below.

This line seems to be missing a check for st2.length:

https://github.com/apache/karaf/blob/main/shell/core/src/main/java/org/apache/karaf/shell/support/table/Row.java#L84

Will link a pull-request.
{code:java}
java.lang.StringIndexOutOfBoundsException: index -1, length 0
    at java.lang.String.checkIndex(String.java:4563) ~[?:?]
    at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:351) ~[?:?]
    at java.lang.StringBuilder.charAt(StringBuilder.java:91) ~[?:?]
    at org.apache.karaf.shell.support.table.Row.getContent(Row.java:84) ~[?:?]
    at org.apache.karaf.shell.support.table.ShellTable.print(ShellTable.java:151) ~[?:?]
    at org.apache.karaf.shell.support.table.ShellTable.print(ShellTable.java:111) ~[?:?]
    at org.apache.karaf.shell.impl.console.commands.help.CommandListHelpProvider.printMethodList(CommandListHelpProvider.java:167) ~[?:?]
{code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)