[
https://hibernate.onjira.com/browse/HV-587?page=com.atlassian.jira.plugin...
]
Hardy Ferentschik commented on HV-587:
--------------------------------------
{quote}
I would assume you have a test suite and create this case at least as quickly as I can
write, zip and attach it.
{quote}
Sure we have a test harness. In fact a testcase which afaics matches your criteria would
look like this:
{code}
public class CascadedValidationTest {
@Test
@TestForIssue(jiraKey = "HV-587")
public void testNoStackOverflow() {
Validator validator = ValidatorUtil.getValidator();
Foo foo = new Foo();
Set<ConstraintViolation<Foo>> violations = validator.validate( foo );
assertNumberOfViolations( violations, 0 );
}
private static class Foo {
private Bar bar;
private Foo() {
this.bar = new Bar( this );
}
@Valid
public Bar getBar() {
return bar;
}
}
private static class Bar {
private Foo foo;
private Bar(Foo foo) {
this.foo = foo;
}
@Valid
public Foo getFoo() {
return foo;
}
}
}
{code}
This test passes just fine.
The reason I am asking for a test case is so that I can actually reproduce the right
scenario. In your description it is open whether the entities references each other as
part of a one to one relationship or as part of a collection association. It also leaves
open whether there are any other constraints.
Even though a testcase which runs directly in our test harness would be the best, I would
have been happy with some actual example code.
stack overflow when having @Valid on cycle
------------------------------------------
Key: HV-587
URL:
https://hibernate.onjira.com/browse/HV-587
Project: Hibernate Validator
Issue Type: Bug
Reporter: Michael G
When I have some entities referencing each other (a cycle), the annotation @Valid is on
the corresponding getters and there is not really something to be validated on these
entities (no @NotNull, ... is present) I end up in a recursion which leads to a stack
overflow.
If there are some @NotNull the detection of cycles does work fine.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira