commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1397) WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE
Date Wed, 16 May 2018 08:42:00 GMT

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

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

Github user coveralls commented on the issue:

    https://github.com/apache/commons-lang/pull/330
  
    
    [![Coverage Status](https://coveralls.io/builds/17007638/badge)](https://coveralls.io/builds/17007638)
    
    Coverage increased (+0.007%) to 95.242% when pulling **2a5c0f0d22f465020314bb029eb758917595a7eb
on tasanuma:LANG-1397-WordUtils** into **961e4a821b66b27c77418dece6017e3fe912fa56 on apache:master**.



> 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)

Mime
View raw message