Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-7580

StringIndexOutOfBoundsException in ShellTable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.3.7, 4.4.1
    • 4.3.8, 4.4.2
    • karaf
    • None

    Description

      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.

      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) ~[?:?]
      

       

      Attachments

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            riconeubauer Rico Neubauer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: