mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix StrUtil.split切分长度为0时的bug;
This commit is contained in:
parent
27b1ff8330
commit
6cd85b7f16
@ -19,6 +19,7 @@ public class LengthFinder extends TextFinder {
|
|||||||
* @param length 长度
|
* @param length 长度
|
||||||
*/
|
*/
|
||||||
public LengthFinder(int length) {
|
public LengthFinder(int length) {
|
||||||
|
Assert.isTrue(length > 0, "Length must be great than 0");
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,9 @@ public class StrUtilTest {
|
|||||||
|
|
||||||
final String[] strings = StrUtil.splitToArray("abc/", '/');
|
final String[] strings = StrUtil.splitToArray("abc/", '/');
|
||||||
Assert.assertEquals(2, strings.length);
|
Assert.assertEquals(2, strings.length);
|
||||||
|
|
||||||
|
// issue:I6FKSI
|
||||||
|
Assert.assertThrows(IllegalArgumentException.class, () -> StrUtil.split("test length 0", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user