-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Closed
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Kazuki Shimizu opened SPR-14888 and commented
In current implementation, the DataBinder
can't detect invalid configuration for autoGrowCollectionLimit
as follow:
DataBinder binder = new DataBinder(new BeanWithIntegerList());
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
binder.setAutoGrowCollectionLimit(257); // Invalid configuration -> But no error
In this case, we should be call the setAutoGrowCollectionLimit method before calling the registerCustomEditor method. I think it would be better to raise an exception as follow:
public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) {
Assert.state(this.bindingResult == null,
"DataBinder is already initialized - call setAutoGrowCollectionLimit before other configuration methods");
this.autoGrowCollectionLimit = autoGrowCollectionLimit;
}
What do you think ?
I will submit a PR at the later.
Affects: 4.2.8, 4.3.4
Issue Links:
- Cannot customize autoGrowCollectionLimit on @InitBinder method when set custom MessageCodesResolver to Spring MVC [SPR-15009] #19576 Cannot customize autoGrowCollectionLimit on
@InitBinder
method when set custom MessageCodesResolver to Spring MVC
Referenced from: pull request #1233
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement