Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82E73C7B8 for ; Wed, 11 Jul 2012 07:32:38 +0000 (UTC) Received: (qmail 13547 invoked by uid 500); 11 Jul 2012 07:32:38 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 13058 invoked by uid 500); 11 Jul 2012 07:32:37 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 12871 invoked by uid 99); 11 Jul 2012 07:32:35 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 07:32:35 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 95FC414285B for ; Wed, 11 Jul 2012 07:32:35 +0000 (UTC) Date: Wed, 11 Jul 2012 07:32:35 +0000 (UTC) From: "Wilf Middleton (JIRA)" To: issues@commons.apache.org Message-ID: <36436930.34002.1341991955616.JavaMail.jiratomcat@issues-vm> In-Reply-To: <1293948079.17813.1341626794829.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Comment Edited] (LANG-810) StringUtils.join() endIndex, bugged for loop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411295#comment-13411295 ] Wilf Middleton edited comment on LANG-810 at 7/11/12 7:32 AM: -------------------------------------------------------------- Re: (the valid array index runs from 0 to array.length-1) Not the case. It accepts array.length as a valid endIndex. According to the spec: "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" was (Author: groovemeister): 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