]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes #1373
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>
Wed, 14 May 2008 13:05:14 +0000 (13:05 +0000)
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>
Wed, 14 May 2008 13:05:14 +0000 (13:05 +0000)
svn changeset:4483/svn branch:trunk

src/com/itmill/toolkit/data/Container.java
src/com/itmill/toolkit/data/Item.java
src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
src/com/itmill/toolkit/data/util/IndexedContainer.java
src/com/itmill/toolkit/data/util/PropertysetItem.java

index 46cedf8e25719e8b27e55c6350033ef0255ad427..80fe984c147864ae7039bc6095cc056c2ad7d893 100644 (file)
@@ -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>
index 4645dbae980ae3ad5d9a3aed8df0a806bba00e96..21964d29b417bb99ba4d40357676cc0723e89e20 100644 (file)
@@ -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>
  * 
index 136bd7318bb34d95029dc9395fe280305f620937..f4ea5b5a5693801eacd4f964a3eef6c0d332cd07 100644 (file)
@@ -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);
index 002cbde9706f5f83b13e50697118627fbe47a0dd..ea8a01756a03555232beb92ccc35e654217fdfff 100644 (file)
@@ -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;
index 457a51321ff62532356a8d90fa78850d7ba18688..b191520a0fb382ebcd8f30742346c9bea85939df 100644 (file)
@@ -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;