Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect invalid configuration for autoGrowCollectionLimit on DataBinder [SPR-14888] #19454

spring-projects-issues opened this issue Nov 8, 2016 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Nov 8, 2016

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:

  • #19576 Cannot customize autoGrowCollectionLimit on @InitBinder method when set custom MessageCodesResolver to Spring MVC

Referenced from: pull request #1233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.