List constructor arg initialized correctly
DataBinder now uses the calculated List size rather than the number of indexes to initialize the list. Closes gh-34145
This commit is contained in:
@@ -1060,7 +1060,9 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
}
|
||||
int size = (indexes.last() < this.autoGrowCollectionLimit ? indexes.last() + 1 : 0);
|
||||
List<V> list = (List<V>) CollectionFactory.createCollection(paramType, size);
|
||||
indexes.forEach(i -> list.add(null));
|
||||
for (int i = 0; i < size; i++) {
|
||||
list.add(null);
|
||||
}
|
||||
for (int index : indexes) {
|
||||
list.set(index, (V) createObject(elementType, paramPath + "[" + index + "].", valueResolver));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user