Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1302

java.lang.StringIndexOutOfBoundsException resulting in WordUtils.wrap

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.5
    • 3.6
    • None
    • None
    • Mac, Android, Linux

    • Important

    Description

      Commons-lang3:3.5

      Issue code:
      String appName = "Google Play Store";
      appName = WordUtils.wrap(appName, appName.length()/2);
      System.out.println(appName);

      Resulting exception:
      Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -3
      at java.lang.String.substring(String.java:1967)
      at org.apache.commons.lang3.text.WordUtils.wrap(WordUtils.java:328)
      at org.apache.commons.lang3.text.WordUtils.wrap(WordUtils.java:176)
      at org.apache.commons.lang3.text.WordUtils.wrap(WordUtils.java:100)
      at removedups.Main2.main(Main2.java:32)

      This exception does not occur in commons-lang3:3.4 though

      Attachments

        Issue Links

          Activity

            People

              dmjones500 Duncan Jones
              developer1011 Vadiraj Purohit
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: