Fixes LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException
This commit is contained in:
parent
8c1a0d2ee1
commit
a08ec31dbf
|
@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<body>
|
||||
|
||||
<release version="3.6" date="2016-MM-DD" description="TBD">
|
||||
<action issue="LANG-1292" type="fix" dev="djones">WordUtils.wrap throws StringIndexOutOfBoundsException</action>
|
||||
<action issue="LANG-1287" type="fix" dev="pschumacher" due-to="Ivan Morozov">RandomStringUtils#random can enter infinite loop if end parameter is to small</action>
|
||||
<action issue="LANG-1285" type="fix" dev="pschumacher" due-to="Francesco Chicchiriccò">NullPointerException in FastDateParser$TimeZoneStrategy</action>
|
||||
<action issue="LANG-1281" type="fix" dev="pschumacher" due-to="Andreas Lundblad">Javadoc of StringUtils.ordinalIndexOf is contradictory.</action>
|
||||
|
|
|
@ -291,7 +291,7 @@ public class WordUtils {
|
|||
offset += matcher.end();
|
||||
continue;
|
||||
}else {
|
||||
spaceToWrapAt = matcher.start();
|
||||
spaceToWrapAt = matcher.start() + offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,7 @@
|
|||
*/
|
||||
package org.apache.commons.lang3.text;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
@ -417,5 +414,13 @@ public class WordUtilsTest {
|
|||
final String expect = "tHIS sTRING CONTAINS A tITLEcASE CHARACTER: \u01C9";
|
||||
assertEquals(expect, WordUtils.swapCase(test));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLANG1292() throws Exception {
|
||||
// Prior to fix, this was throwing StringIndexOutOfBoundsException
|
||||
WordUtils.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "
|
||||
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "
|
||||
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",70);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue