Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6285

ChatPaginator#wordWrap throws StringIndexOutOfBoundsException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • This server is running CraftBukkit version git-Spigot-628435a-878b437 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)
    • Yes

      The wordWrap method is throwing StringIndexOutOfBoundsException when wraping:

      • raw string "&a" and length 1
      • raw string "&a&aa" and length 3
      • raw string "&a&a&a" and length 5

      The problem seems to be related to colors, if I remove them it works normally.

      From the tests, I get that if the color block has a length bigger than that passed on the method it throws the exception.

       

      I wrote a simple plugin to test that; it has a command /cpt <length> <string>

      So to reproduce, load the plugin and run any of:

      • /cpt 1 &a
      • /cpt 3 &a&aa
      • /cpt 5 &a&a&a

       

      PS.: I'm using & because the test plugin translates this symbol.

            Unassigned Unassigned
            GhostTheWolf GhostTheWolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: