Fix regression with binding and validation

Previously, the binding may have to call the getter first to retrieve the
old value of a property before actually setting it. This was guarded by
a catch block that was accidentally removed in 3d86f15

Restore that catch block and add a test to cover it.

Issue: SPR-12805
This commit is contained in:
Stephane Nicoll
2015-05-21 17:48:11 +02:00
parent 2ab34373d1
commit 6fb3190353
2 changed files with 22 additions and 1 deletions

View File

@@ -51,6 +51,15 @@ public final class BeanWrapperTests extends AbstractConfigurablePropertyAccessor
assertTrue("Set name to tom", target.getName().equals("tom"));
}
@Test
public void getterSilentlyFailWithOldValueExtraction() {
GetterBean target = new GetterBean();
BeanWrapper accessor = createAccessor(target);
accessor.setExtractOldValueForEditor(true); // This will call the getter
accessor.setPropertyValue("name", "tom");
assertTrue("Set name to tom", target.getName().equals("tom"));
}
@Test
public void setValidAndInvalidPropertyValuesShouldContainExceptionDetails() {
TestBean target = new TestBean();