]> source.dussan.org Git - vaadin-framework.git/commitdiff
Don't complain about missing sync id for critical notifications (#14081)
authorLeif Åstrand <leif@vaadin.com>
Wed, 25 Jun 2014 10:50:14 +0000 (13:50 +0300)
committerLeif Åstrand <leif@vaadin.com>
Wed, 25 Jun 2014 10:50:14 +0000 (13:50 +0300)
Change-Id: I351d256230a5cd674a5e1b8066d3e2aef07ff3bf

client/src/com/vaadin/client/ApplicationConnection.java
server/src/com/vaadin/server/VaadinService.java

index 5d696f1ddbbe31d55cb9eb9529301550c52867a5..8bc43dda9ac4f381c7ebe5e1ca9e420cbe8b8ee6 100644 (file)
@@ -66,6 +66,7 @@ import com.google.gwt.user.client.Window.ClosingHandler;
 import com.google.gwt.user.client.ui.HasWidgets;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.ApplicationConfiguration.ErrorMessage;
+import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent;
 import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
 import com.vaadin.client.ResourceLoader.ResourceLoadListener;
 import com.vaadin.client.communication.HasJavaScriptConnectorHelper;
@@ -1431,10 +1432,16 @@ public class ApplicationConnection implements HasHandlers {
         if (json.containsKey(ApplicationConstants.SERVER_SYNC_ID)) {
             int syncId = json.getInt(ApplicationConstants.SERVER_SYNC_ID);
 
-            assert (lastSeenServerSyncId == UNDEFINED_SYNC_ID || syncId == lastSeenServerSyncId + 1) : "Newly retrieved server sync id was not exactly one larger than the previous one (new: "
-                    + syncId + ", last seen: " + lastSeenServerSyncId + ")";
+            /*
+             * Use sync id unless explicitly set as undefined, as is done by
+             * e.g. critical server-side notifications
+             */
+            if (syncId != -1) {
+                assert (lastSeenServerSyncId == UNDEFINED_SYNC_ID || syncId == lastSeenServerSyncId + 1) : "Newly retrieved server sync id was not exactly one larger than the previous one (new: "
+                        + syncId + ", last seen: " + lastSeenServerSyncId + ")";
 
-            lastSeenServerSyncId = syncId;
+                lastSeenServerSyncId = syncId;
+            }
         } else {
             VConsole.error("Server response didn't contain a sync id. "
                     + "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
index 08bc6f5c79831b53754d111f82950400eaa539d1..e8cdcd7055e5b3374fe00b5d7b578792cc27455f 100644 (file)
@@ -59,6 +59,7 @@ import com.vaadin.server.communication.HeartbeatHandler;
 import com.vaadin.server.communication.PublishedFileHandler;
 import com.vaadin.server.communication.SessionRequestHandler;
 import com.vaadin.server.communication.UidlRequestHandler;
+import com.vaadin.shared.ApplicationConstants;
 import com.vaadin.shared.JsonConstants;
 import com.vaadin.shared.ui.ui.UIConstants;
 import com.vaadin.ui.UI;
@@ -1590,6 +1591,7 @@ public abstract class VaadinService implements Serializable {
             json.put("resources", new JSONObject());
             json.put("locales", new JSONObject());
             json.put("meta", meta);
+            json.put(ApplicationConstants.SERVER_SYNC_ID, -1);
             returnString = json.toString();
         } catch (JSONException e) {
             getLogger().log(Level.WARNING,