You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2018/05/18 17:47:00 UTC

[jira] [Moved] (TEXT-123) CLONE - WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE

     [ https://issues.apache.org/jira/browse/TEXT-123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory moved LANG-1398 to TEXT-123:
-----------------------------------------

        Fix Version/s:     (was: 3.8)
                       1.4
    Affects Version/s:     (was: 3.7)
                       1.3
    External issue ID:   (was: 330)
             Workflow: jira  (was: Default workflow, editable Closed status)
                  Key: TEXT-123  (was: LANG-1398)
              Project: Commons Text  (was: Commons Lang)

> CLONE - WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE
> --------------------------------------------------------------------------------------------------
>
>                 Key: TEXT-123
>                 URL: https://issues.apache.org/jira/browse/TEXT-123
>             Project: Commons Text
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Takanobu Asanuma
>            Assignee: Gary Gregory
>            Priority: Major
>             Fix For: 1.4
>
>
> 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)