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, 11 Jul 2012 07:32:35 GMT

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

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

The javadoc states: 

"endIndex - the index to stop joining from (exclusive). It is an error to pass in an end index
past the end of the array"

The last index is array.length-1. The method accepts array.length as the last index which
is against the stipulation that "it is an error to pass in an end index past the end of the
array."

It would be correct to say:

"endIndex - the index to stop joining from (exclusive). It is an error to pass in an end index
GREATER THAN THE LENGTH OF THE ARRAY"


                
> 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
>            Assignee: Joerg Schaible
>   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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message