[LANG-1397] WordUtils.wrap throws StringIndexOutOfBoundsException when
wrapLength is Integer.MAX_VALUE.
This commit is contained in:
parent
bd4066eba8
commit
09ef69c5b5
|
@ -56,6 +56,7 @@ The <action> type attribute can be add,update,fix,remove.
|
||||||
<action issue="LANG-1371" type="fix" dev="pschumacher" due-to="Dmitry Ovchinnikov">Fix TypeUtils#parameterize to work correctly with narrower-typed array</action>
|
<action issue="LANG-1371" type="fix" dev="pschumacher" due-to="Dmitry Ovchinnikov">Fix TypeUtils#parameterize to work correctly with narrower-typed array</action>
|
||||||
<action issue="LANG-1370" type="fix" dev="kinow" due-to="Andre Dieb">Fix EventCountCircuitBreaker increment batch</action>
|
<action issue="LANG-1370" type="fix" dev="kinow" due-to="Andre Dieb">Fix EventCountCircuitBreaker increment batch</action>
|
||||||
<action issue="LANG-1385" type="fix" dev="ggregory" due-to="Rohan Padhye">NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException</action>
|
<action issue="LANG-1385" type="fix" dev="ggregory" due-to="Rohan Padhye">NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException</action>
|
||||||
|
<action issue="LANG-1397" type="fix" dev="ggregory" due-to="Takanobu Asanuma">WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE.</action>
|
||||||
<action issue="LANG-1367" type="update" dev="ggregory" due-to="Gary Gregory">ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size</action>
|
<action issue="LANG-1367" type="update" dev="ggregory" due-to="Gary Gregory">ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size</action>
|
||||||
<action issue="LANG-1352" type="add" dev="pschumacher" due-to="Ruslan Sibgatullin">EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added</action>
|
<action issue="LANG-1352" type="add" dev="pschumacher" due-to="Ruslan Sibgatullin">EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added</action>
|
||||||
<action issue="LANG-1372" type="add" dev="pschumacher" due-to="Sérgio Ozaki">Add ToStringSummary annotation</action>
|
<action issue="LANG-1372" type="add" dev="pschumacher" due-to="Sérgio Ozaki">Add ToStringSummary annotation</action>
|
||||||
|
|
|
@ -288,7 +288,8 @@ public class WordUtils {
|
||||||
|
|
||||||
while (offset < inputLineLength) {
|
while (offset < inputLineLength) {
|
||||||
int spaceToWrapAt = -1;
|
int spaceToWrapAt = -1;
|
||||||
Matcher matcher = patternToWrapOn.matcher(str.substring(offset, Math.min(offset + wrapLength + 1, inputLineLength)));
|
Matcher matcher = patternToWrapOn.matcher(
|
||||||
|
str.substring(offset, Math.min((int)Math.min(Integer.MAX_VALUE, offset + wrapLength + 1L), inputLineLength)));
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
if (matcher.start() == 0) {
|
if (matcher.start() == 0) {
|
||||||
offset += matcher.end();
|
offset += matcher.end();
|
||||||
|
|
|
@ -427,4 +427,11 @@ public class WordUtilsTest {
|
||||||
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",70);
|
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",70);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLANG1397() throws Exception {
|
||||||
|
// Prior to fix, this was throwing StringIndexOutOfBoundsException
|
||||||
|
WordUtils.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "
|
||||||
|
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "
|
||||||
|
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue