Author: sebb
Date: Wed Sep 12 21:52:58 2012
New Revision: 1384145
URL: http://svn.apache.org/viewvc?rev=1384145&view=rev
Log:
LANG-810 StringUtils.join() endIndex, bugged for loop
Modified:
commons/proper/lang/trunk/src/changes/changes.xml
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Modified: commons/proper/lang/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1384145&r1=1384144&r2=1384145&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/changes/changes.xml (original)
+++ commons/proper/lang/trunk/src/changes/changes.xml Wed Sep 12 21:52:58 2012
@@ -24,6 +24,7 @@
<release version="3.2" date="TBA" description="Next release">
<action issue="LANG-817" type="fix">Add
org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS_8</action>
<action issue="LANG-813" type="fix">StringUtils.equalsIgnoreCase doesn't
check string reference equality</action>
+ <action issue="LANG-810" type="fix">StringUtils.join() endIndex, bugged
for loop</action>
<action issue="LANG-807" type="fix">RandomStringUtils throws confusing IAE
when end <= start</action>
<action issue="LANG-805" type="fix">RandomStringUtils.random(count, 0, 0,
false, false, universe, random) always throws
java.lang.ArrayIndexOutOfBoundsException</action>
<action issue="LANG-802" type="fix">LocaleUtils - unnecessary recursive
call in SyncAvoid class.</action>
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1384145&r1=1384144&r2=1384145&view=diff
==============================================================================
---
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
(original)
+++
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Wed Sep 12 21:52:58 2012
@@ -3246,22 +3246,30 @@ public class StringUtils {
* empty strings.</p>
*
* <pre>
- * StringUtils.join(null, *) = null
- * StringUtils.join([], *) = ""
- * StringUtils.join([null], *) = ""
- * StringUtils.join(["a", "b", "c"], "--") = "a--b--c"
- * StringUtils.join(["a", "b", "c"], null) = "abc"
- * StringUtils.join(["a", "b", "c"], "") = "abc"
- * StringUtils.join([null, "", "a"], ',') = ",,a"
+ * StringUtils.join(null, *, *, *) = null
+ * StringUtils.join([], *, *, *) = ""
+ * StringUtils.join([null], *, *, *) = ""
+ * StringUtils.join(["a", "b", "c"], "--", 0, 3) = "a--b--c"
+ * StringUtils.join(["a", "b", "c"], "--", 1, 3) = "b--c"
+ * StringUtils.join(["a", "b", "c"], "--", 2, 3) = "c"
+ * StringUtils.join(["a", "b", "c"], "--", 2, 2) = ""
+ * StringUtils.join(["a", "b", "c"], null, 0, 3) = "abc"
+ * StringUtils.join(["a", "b", "c"], "", 0, 3) = "abc"
+ * StringUtils.join([null, "", "a"], ',', 0, 3) = ",,a"
* </pre>
*
* @param array the array of values to join together, may be null
* @param separator the separator character to use, null treated as ""
- * @param startIndex the first index to start joining from. It is
- * an error to pass in an end index past the end of the array
- * @param endIndex the index to stop joining from (exclusive). It is
- * an error to pass in an end index past the end of the array
- * @return the joined String, {@code null} if null array input
+ * @param startIndex the first index to start joining from.
+ * @param endIndex the index to stop joining from (exclusive).
+ * @return the joined String, {@code null} if null array input; or the
empty string
+ * if {@code endIndex - startIndex <= 0}. The number of joined entries is
given by
+ * {@code endIndex - startIndex}
+ * @throws ArrayIndexOutOfBoundsException ife<br/>
+ * {@code startIndex < 0} or <br/>
+ * {@code startIndex >= array.length()} or <br/>
+ * {@code endIndex < 0} or <br/>
+ * {@code endIndex > array.length()}
*/
public static String join(Object[] array, String separator, int
startIndex, int endIndex) {
if (array == null) {