-
Type:
Improvement
-
Status: Closed
-
Priority:
Minor
-
Resolution: Complete
-
Affects Version/s: 4.2.8, 4.3.4
-
Component/s: Core
-
Labels:None
-
Last commented by a User:true
-
Pull Request URL:
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.
- is related to
-
SPR-15009 Cannot customize autoGrowCollectionLimit on @InitBinder method when set custom MessageCodesResolver to Spring MVC
-
- Closed
-