Commons Lang
  1. Commons Lang
  2. LANG-419

WordUtils.abbreviate bug when lower is greater than str.length

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.5
    • Component/s: lang.*
    • Labels:
      None

      Description

      In WordUtils.abbreviate, upper is adjusted to the length of the string, then to lower.
      But lower is never adjusted to the length of the string, so if lower is greater than str.lengt(), upper will be too...
      Then, str.substring(0, upper) throw a StringIndexOutOfBoundsException

      The fix is to adjust lower to the length of the string

        Activity

        Vincent Behar created issue -
        Vincent Behar made changes -
        Field Original Value New Value
        Attachment WordUtils_abbreviate_lowerLimit_bug.patch [ 12378641 ]
        Henri Yandell made changes -
        Fix Version/s 3.0 [ 12311714 ]
        Vincent Behar made changes -
        Henri Yandell made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Henri Yandell made changes -
        Component/s lang.* [ 12313203 ]
        Niall Pemberton made changes -
        Fix Version/s 2.5 [ 12314743 ]
        Fix Version/s 3.0 [ 12311714 ]
        Mark Thomas made changes -
        Workflow jira [ 12427397 ] Default workflow, editable Closed status [ 12602432 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Vincent Behar
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development