summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2013-02-08 07:52:59 +0000
committerVaadin Code Review <review@vaadin.com>2013-02-08 07:52:59 +0000
commit12996f599cf5284b4c2994764e26e700011e1a64 (patch)
tree3184f7eac6e7cdb1fafc332cbe9819a125a296b8 /server
parent6e6855ec13af4f6a59a0f47410caa32f0b528777 (diff)
parentaf82e142c37e08bbda7e3869072460c92f1fb575 (diff)
downloadvaadin-framework-12996f599cf5284b4c2994764e26e700011e1a64.tar.gz
vaadin-framework-12996f599cf5284b4c2994764e26e700011e1a64.zip
Merge "Do not throw NPE when asking for a null propertyId (#10445)"
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/data/util/IndexedContainer.java3
-rw-r--r--server/tests/src/com/vaadin/data/util/TestIndexedContainer.java8
2 files changed, 10 insertions, 1 deletions
diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java
index 1705365f60..306f9cf23b 100644
--- a/server/src/com/vaadin/data/util/IndexedContainer.java
+++ b/server/src/com/vaadin/data/util/IndexedContainer.java
@@ -166,7 +166,8 @@ public class IndexedContainer extends
public Property getContainerProperty(Object itemId, Object propertyId) {
// map lookup more efficient than propertyIds if there are many
// properties
- if (!containsId(itemId) || !types.containsKey(propertyId)) {
+ if (!containsId(itemId) || propertyId == null
+ || !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 971cdb5f62..09e5a26c15 100644
--- a/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java
+++ b/server/tests/src/com/vaadin/data/util/TestIndexedContainer.java
@@ -384,4 +384,12 @@ public class TestIndexedContainer extends AbstractInMemoryContainerTest {
assertNull(ic.getContainerProperty(object1, "xyz"));
}
+ // test getting null property id (#10445)
+ public void testNullPropertyId() {
+ IndexedContainer ic = new IndexedContainer();
+ String object1 = new String("Obj1");
+ ic.addItem(object1);
+ assertNull(ic.getContainerProperty(object1, null));
+ }
+
}