mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
setOrPadding增加重载,可选限制index大小
This commit is contained in:
@@ -455,7 +455,7 @@ public class JSONArray implements JSON, JSONGetter<Integer>, List<Object>, Rando
|
||||
// issue#3286, 如果用户指定的index太大,容易造成Java heap space错误。
|
||||
if (!config.isIgnoreNullValue()) {
|
||||
// issue#3286, 增加安全检查,最多增加10倍
|
||||
Validator.checkIndexLimit(index, this.size());
|
||||
Validator.checkIndexLimit(index, (this.size() + 1) * 10);
|
||||
while (index != this.size()) {
|
||||
// 非末尾,则填充null
|
||||
this.add(null);
|
||||
|
Reference in New Issue
Block a user