[ 
https://issues.apache.org/jira/browse/LANG-1397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16477042#comment-16477042
 ] 

ASF GitHub Bot commented on LANG-1397:
--------------------------------------

GitHub user tasanuma opened a pull request:

    https://github.com/apache/commons-lang/pull/330

    LANG-1397: WordUtils.wrap throws StringIndexOutOfBoundsException when 
wrapLength is Integer.MAX_VALUE

    There is a bug of WordUtils. WordUtils in commons-text has the same bug. I 
will work on it after merging this pull request.
    
    This is my first contribute to this project. I confirmed `mvn clean verify` 
succeeds. If there is any problem, please let me know.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tasanuma/commons-lang LANG-1397-WordUtils

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/330.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #330
    
----
commit 2a5c0f0d22f465020314bb029eb758917595a7eb
Author: Takanobu Asanuma <tasanuma@...>
Date:   2018-05-16T08:06:03Z

    fix a bug of WordUtils

----


> 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
>            Priority: Major
>
> 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