commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilf Middleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-810) StringUtils.join() endIndex, bugged for loop
Date Wed, 12 Sep 2012 22:11:10 GMT

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

Wilf Middleton commented on LANG-810:
-------------------------------------

The example in the svn JAVADOC is for the different method:

OLD

3169	     * <pre>
3170	     * StringUtils.join(null, *)               = null
3171	     * StringUtils.join([], *)                 = ""
3172	     * StringUtils.join([null], *)             = ""
3173	     * StringUtils.join(["a", "b", "c"], ';')  = "a;b;c"
3174	     * StringUtils.join(["a", "b", "c"], null) = "abc"
3175	     * StringUtils.join([null, "", "a"], ';')  = ";;a"
3176	     * </pre>


SHOULD READ SOMETHING LIKE THIS

StringUtils.join(null,'a',0,0)                   = null
StringUtils.join(null,'a',999,999)               = null
StringUtils.join([],'a',0,0)                     = ""
StringUtils.join([],'a',0,1)                     = ERROR
StringUtils.join(["a", "b", "c"], ';',0,1)       = "a"
StringUtils.join(["a", "b", "c"], ';',0,2)       = "a;b"
StringUtils.join(["a", "b", "c"], ';',0,3)       = "a;b;c"
StringUtils.join([null, null, "a"], ';',0,2)     = ";;"
StringUtils.join([null, null, "a"], ';',0,3)     = ";;a"

                
> StringUtils.join() endIndex, bugged for loop
> --------------------------------------------
>
>                 Key: LANG-810
>                 URL: https://issues.apache.org/jira/browse/LANG-810
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Krzysztof Nazarewski
>             Fix For: 3.2
>
>         Attachments: StringUtilsArraysJoinTest.java, StringUtils.java
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> endIndex is described as index, but for loop still checks it as "array length".
> Basically missing equal sign
> commons-lang3-3.1-sources.jar, StringUtils.java lines 3309, 3394:
>         for (int i = startIndex; i < endIndex; i++) {
> should be:
>         for (int i = startIndex; i <= endIndex; i++) {

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message