aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>2008-05-14 13:05:14 +0000
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>2008-05-14 13:05:14 +0000
commitcec9c6bdcffde03fbfd69b3a1872e4399fc28213 (patch)
tree8fc37521eae4ef8d0db56f8538adcaff653ca4b0 /src
parentb24d340f8b0dc228f666575afb9f3e608b362da2 (diff)
downloadvaadin-framework-cec9c6bdcffde03fbfd69b3a1872e4399fc28213.tar.gz
vaadin-framework-cec9c6bdcffde03fbfd69b3a1872e4399fc28213.zip
Fixes #1373
svn changeset:4483/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/data/Container.java1
-rw-r--r--src/com/itmill/toolkit/data/Item.java2
-rw-r--r--src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java3
-rw-r--r--src/com/itmill/toolkit/data/util/IndexedContainer.java10
-rw-r--r--src/com/itmill/toolkit/data/util/PropertysetItem.java3
5 files changed, 17 insertions, 2 deletions
diff --git a/src/com/itmill/toolkit/data/Container.java b/src/com/itmill/toolkit/data/Container.java
index 46cedf8e25..80fe984c14 100644
--- a/src/com/itmill/toolkit/data/Container.java
+++ b/src/com/itmill/toolkit/data/Container.java
@@ -19,6 +19,7 @@ import java.util.Collection;
* {@link Item#getItemPropertyIds()}).
* <li>all Properties in the Items corresponding to the same Property ID must
* have the same data type.
+ * <li>All Items within a container are uniquely identified by their non-null ids
* </ul>
*
* <p>
diff --git a/src/com/itmill/toolkit/data/Item.java b/src/com/itmill/toolkit/data/Item.java
index 4645dbae98..21964d29b4 100644
--- a/src/com/itmill/toolkit/data/Item.java
+++ b/src/com/itmill/toolkit/data/Item.java
@@ -9,7 +9,7 @@ import java.util.Collection;
/**
* <p>
* Provides a mechanism for handling a set of Properties, each associated to a
- * locally unique identifier. The interface is split into subinterfaces to
+ * locally unique non-null identifier. The interface is split into subinterfaces to
* enable a class to implement only the functionalities it needs.
* </p>
*
diff --git a/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java b/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
index 136bd7318b..f4ea5b5a56 100644
--- a/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
+++ b/src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
@@ -439,6 +439,9 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
*/
public Item addItem(Object itemId) throws UnsupportedOperationException {
+ // Null ids are not accepted
+ if (itemId == null) throw new NullPointerException("Container item id can not be null");
+
final Item item = container.addItem(itemId);
if (!hierarchical && item != null) {
addToHierarchyWrapper(itemId);
diff --git a/src/com/itmill/toolkit/data/util/IndexedContainer.java b/src/com/itmill/toolkit/data/util/IndexedContainer.java
index 002cbde970..ea8a01756a 100644
--- a/src/com/itmill/toolkit/data/util/IndexedContainer.java
+++ b/src/com/itmill/toolkit/data/util/IndexedContainer.java
@@ -140,6 +140,10 @@ public class IndexedContainer implements Container, Container.Indexed,
* not found in the list
*/
public Item getItem(Object itemId) {
+
+ // Null ids are not accepted
+ if (itemId == null) throw new NullPointerException("Container item id can not be null");
+
if (items.containsKey(itemId)
&& (filteredItemIds == null || filteredItemIds.contains(itemId))) {
return new IndexedContainerItem(itemId);
@@ -335,6 +339,9 @@ public class IndexedContainer implements Container, Container.Indexed,
*/
public Item addItem(Object itemId) {
+ // Null ids are not accepted
+ if (itemId == null) throw new NullPointerException("Container item id can not be null");
+
// Makes sure that the Item has not been created yet
if (items.containsKey(itemId)) {
return null;
@@ -1188,7 +1195,8 @@ public class IndexedContainer implements Container, Container.Indexed,
*/
private IndexedContainerProperty(Object itemId, Object propertyId) {
if (itemId == null || propertyId == null) {
- throw new NullPointerException();
+ // Null ids are not accepted
+ throw new NullPointerException("Container item or property ids can not be null");
}
this.propertyId = propertyId;
this.itemId = itemId;
diff --git a/src/com/itmill/toolkit/data/util/PropertysetItem.java b/src/com/itmill/toolkit/data/util/PropertysetItem.java
index 457a51321f..b191520a0f 100644
--- a/src/com/itmill/toolkit/data/util/PropertysetItem.java
+++ b/src/com/itmill/toolkit/data/util/PropertysetItem.java
@@ -108,6 +108,9 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
*/
public boolean addItemProperty(Object id, Property property) {
+ // Null ids are not accepted
+ if (id == null) throw new NullPointerException("Item property id can not be null");
+
// Cant add a property twice
if (map.containsKey(id)) {
return false;