Detect invalid configuration for autoGrowCollectionLimit on DataBinder

Issue: SPR-14888
This commit is contained in:
Kazuki Shimizu
2016-11-09 01:00:27 +09:00
parent dda9762072
commit 124f2128fa
2 changed files with 35 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ import org.springframework.util.StringUtils;
* @author Juergen Hoeller
* @author Rob Harrop
* @author Stephane Nicoll
* @author Kazuki Shimizu
* @see #setAllowedFields
* @see #setRequiredFields
* @see #registerCustomEditor
@@ -213,8 +214,12 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* Specify the limit for array and collection auto-growing.
* <p>Default is 256, preventing OutOfMemoryErrors in case of large indexes.
* Raise this limit if your auto-growing needs are unusually high.
* @see #initBeanPropertyAccess()
* @see org.springframework.beans.BeanWrapper#setAutoGrowCollectionLimit
*/
public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) {
Assert.state(this.bindingResult == null,
"DataBinder is already initialized - call setAutoGrowCollectionLimit before other configuration methods");
this.autoGrowCollectionLimit = autoGrowCollectionLimit;
}