Takanobu Asanuma created LANG-1397:
--------------------------------------

             Summary: WordUtils.wrap throws StringIndexOutOfBoundsException 
when wrapLength is Integer.MAX_VALUE
                 Key: LANG-1397
                 URL: https://issues.apache.org/jira/browse/LANG-1397
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 3.7
            Reporter: Takanobu Asanuma


This is the sample code.
{code:java}
int max = Integer.MAX_VALUE;  // 2147483647
WordUtils.wrap("foobar", max, "\n", true);
{code}

and the error log.
{noformat}
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: -2147483648
        at java.lang.String.substring(String.java:1967)
        at org.apache.commons.lang3.text.WordUtils.wrap(WordUtils.java:291)
        at org.apache.commons.lang3.text.WordUtils.wrap(WordUtils.java:179)
{noformat}

Seems WordUtils in commons-text has the same bug. I will file it on 
commons-text side later.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to