diff options
author | Ilya Ermakov <ilya403403@gmail.com> | 2014-11-28 13:09:38 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-12-09 12:17:27 +0200 |
commit | 16cb0d22809f2897ec88fc80068deb5e0ef8c174 (patch) | |
tree | 391470da3bfd32d89898e69fb7df77cb49425c03 /server/src | |
parent | 3e3a1cd47da6478a0c308b42925928b9e11ef968 (diff) | |
download | vaadin-framework-16cb0d22809f2897ec88fc80068deb5e0ef8c174.tar.gz vaadin-framework-16cb0d22809f2897ec88fc80068deb5e0ef8c174.zip |
SQLContainer removeItem Error when isModified (#8802)
This patch makes commit() work properly if an item was modified and later deleted.
Change-Id: I5a00024112e7b6bb7ab3750c292a872937f03af9
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java index 683140d279..70b392ab80 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java @@ -1020,18 +1020,20 @@ public class SQLContainer implements Container, Container.Filterable, } /* Perform buffered modifications */ for (RowItem item : modifiedItems) { - if (queryDelegate.storeRow(item) > 0) { - /* - * Also reset the modified state in the item in case it is - * reused e.g. in a form. - */ - item.commit(); - } else { - queryDelegate.rollback(); - refresh(); - throw new ConcurrentModificationException( - "Item with the ID '" + item.getId() - + "' has been externally modified."); + if (!removedItems.containsKey(item.getId())) { + if (queryDelegate.storeRow(item) > 0) { + /* + * Also reset the modified state in the item in case it + * is reused e.g. in a form. + */ + item.commit(); + } else { + queryDelegate.rollback(); + refresh(); + throw new ConcurrentModificationException( + "Item with the ID '" + item.getId() + + "' has been externally modified."); + } } } /* Perform buffered additions */ |