mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +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 长度
|
||||
*/
|
||||
public LengthFinder(int length) {
|
||||
Assert.isTrue(length > 0, "Length must be great than 0");
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,9 @@ public class StrUtilTest {
|
||||
|
||||
final String[] strings = StrUtil.splitToArray("abc/", '/');
|
||||
Assert.assertEquals(2, strings.length);
|
||||
|
||||
// issue:I6FKSI
|
||||
Assert.assertThrows(IllegalArgumentException.class, () -> StrUtil.split("test length 0", 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user