summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Motornyi <elmot@vaadin.com>2017-06-30 10:59:13 +0300
committerGitHub <noreply@github.com>2017-06-30 10:59:13 +0300
commit05fa102f874cc3dc1dcea1191d1a4eabc8f6125b (patch)
treed1f9158b1ba1bb9168b34fd8d071e592bbbc8bea
parent0b1345ea59a3c6765b8bcc597e3d2208a8bd6563 (diff)
downloadvaadin-framework-05fa102f874cc3dc1dcea1191d1a4eabc8f6125b.tar.gz
vaadin-framework-05fa102f874cc3dc1dcea1191d1a4eabc8f6125b.zip
Fix bookkeeping assertion error
Fixes #9584
-rw-r--r--server/src/main/java/com/vaadin/data/provider/DataCommunicator.java1
-rw-r--r--server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java23
-rw-r--r--shared/src/main/java/com/vaadin/shared/Range.java2
3 files changed, 25 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java b/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java
index 0971c36755..054e86ca8d 100644
--- a/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java
+++ b/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java
@@ -185,6 +185,7 @@ public class DataCommunicator<T> extends AbstractExtension {
@Override
public void destroyAllData() {
+ droppedData.clear();
activeData.clear();
getKeyMapper().removeAll();
}
diff --git a/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java b/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java
index 1e75d57263..c6d80e6ab0 100644
--- a/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java
@@ -18,6 +18,8 @@ package com.vaadin.data.provider;
import java.util.Collections;
import java.util.concurrent.Future;
+import elemental.json.Json;
+import elemental.json.JsonArray;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -191,4 +193,25 @@ public class DataCommunicatorTest {
TEST_OBJECT, generator.generated);
}
+ @Test
+ public void testDestroyData() {
+ session.lock();
+ UI ui = new TestUI(session);
+ TestDataCommunicator communicator = new TestDataCommunicator();
+ TestDataProvider dataProvider = new TestDataProvider();
+ communicator.setDataProvider(dataProvider, null);
+ communicator.extend(ui);
+ // Put a test object into a cache
+ communicator.pushData(1, Collections.singletonList(TEST_OBJECT));
+ // Drop the test object from the cache
+ String key = communicator.getKeyMapper().key(TEST_OBJECT);
+ JsonArray keys = Json.createArray();
+ keys.set(0,key);
+ communicator.onDropRows(keys);
+ // Drop everything
+ communicator.dropAllData();
+ // The communicator does not have to throw exceptions during
+ // request finalization
+ communicator.beforeClientResponse(false);
+ }
}
diff --git a/shared/src/main/java/com/vaadin/shared/Range.java b/shared/src/main/java/com/vaadin/shared/Range.java
index 49458d848b..3f670ca28c 100644
--- a/shared/src/main/java/com/vaadin/shared/Range.java
+++ b/shared/src/main/java/com/vaadin/shared/Range.java
@@ -229,7 +229,7 @@ public final class Range implements Serializable {
@Override
public String toString() {
return getClass().getSimpleName() + " [" + getStart() + ".." + getEnd()
- + "[" + (isEmpty() ? " (empty)" : "");
+ + "]" + (isEmpty() ? " (empty)" : "");
}
@Override