diff options
-rw-r--r-- | server/src/com/vaadin/data/util/IndexedContainer.java | 4 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/data/util/TestIndexedContainer.java | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java index 81ee4ae2a0..aeb0ca96eb 100644 --- a/server/src/com/vaadin/data/util/IndexedContainer.java +++ b/server/src/com/vaadin/data/util/IndexedContainer.java @@ -164,7 +164,9 @@ public class IndexedContainer extends */ @Override public Property getContainerProperty(Object itemId, Object propertyId) { - if (!containsId(itemId)) { + // map lookup more efficient than propertyIds if there are many + // properties + if (!containsId(itemId) || !types.containsKey(propertyId)) { return null; } diff --git a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java index 20aadfcb8b..971cdb5f62 100644 --- a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java +++ b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java @@ -376,4 +376,12 @@ public class TestIndexedContainer extends AbstractInMemoryContainerTest { } } + // test getting non-existing property (#10445) + public void testNonExistingProperty() { + IndexedContainer ic = new IndexedContainer(); + String object1 = new String("Obj1"); + ic.addItem(object1); + assertNull(ic.getContainerProperty(object1, "xyz")); + } + } |