diff options
author | Olli Tietäväinen <ollit@vaadin.com> | 2017-10-04 13:18:38 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-04 13:18:38 +0300 |
commit | 0eabcf3094dd81dbf15454145eec780130bc091c (patch) | |
tree | 38ae912b42d2646c52a20ff0693b76018e268f8e /compatibility-server/src | |
parent | 83f5e593f66d36d99b22298e8023afd3c31a6122 (diff) | |
download | vaadin-framework-0eabcf3094dd81dbf15454145eec780130bc091c.tar.gz vaadin-framework-0eabcf3094dd81dbf15454145eec780130bc091c.zip |
Support null intermediate properties in NestedMethodProperty (#10134)
Ignore null intermediate properties in setValue().
Forward port of #10085 in 7.7 to the compatibility package.
Diffstat (limited to 'compatibility-server/src')
-rw-r--r-- | compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java | 3 | ||||
-rw-r--r-- | compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java index 4228f04dcb..e9a24d040e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java @@ -253,6 +253,9 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> { Object object = instance; for (int i = 0; i < getMethods.size() - 1; i++) { object = getMethods.get(i).invoke(object); + if (object == null) { + return; + } } setMethod.invoke(object, new Object[] { value }); } catch (final InvocationTargetException e) { diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java index 96065ae199..82e3fbb86a 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java @@ -308,6 +308,12 @@ public class NestedMethodPropertyTest { Address address2 = new Address("Other street", 12345); addressProperty.setValue(address2); assertEquals("Other street", streetProperty.getValue()); + + Address address3 = null; + addressProperty.setValue(address3); + assertEquals(null, addressProperty.getValue()); + streetProperty.setValue("Ruukinkatu"); + assertEquals(null, streetProperty.getValue()); } @Test |