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

(validation) Random error order in BindingResult object [SPR-9562] #14196

Closed
spring-issuemaster opened this issue Jul 4, 2012 · 6 comments
Closed
Assignees

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 4, 2012

Andrei opened SPR-9562 and commented

We seem to be getting errors in random order in the BindingResult object when using more than one validation annotation.

@NotEmpty(message = "lore ipsum")
@Pattern(regexp = "\d*", message = "lore ipsum")
@Length(max = 4, message = "lore ipsum")

If the input is empty we'll have the 3 messages in the BindingResult but the order is never the same.


Affects: 3.1.1

3 votes, 7 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 10, 2012

Rossen Stoyanchev commented

AbstractBindingResult stores errors in a LinkedList so I'm not sure where this is coming from. Does the bean validation implementation you're using return constraint violations in a fixed order?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 18, 2012

Marcel Overdijk commented

I'm experiencing this as well.
In my project we are using Hibernate Validator as JSR 303 implementation.
I'm not defining anything else special as Spring is picking up this automatically and creating the right beans internally.

Also see this discussion: http://forum.springsource.org/showthread.php?98230-JSR-303-Error-Message-order

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 24, 2012

Andrei commented

We are also using Hibernate Validator as JSR 303 implementation and getting the errors in random order

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Dec 4, 2016

Georgy commented

+1 the same issue

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Dec 4, 2016

Juergen Hoeller commented

I suspect this is caused by Bean Validation's iteration over constraints, assumably in a HashSet with hash order over annotation types which is rather unpredictable. From that perspective, it's a problem to be reported to Hibernate Validator and the Bean Validation specification.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Dec 7, 2016

Rossen Stoyanchev commented

Resolving for now as this is an issue we can't address from Spring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.