]> source.dussan.org Git - vaadin-framework.git/commitdiff
Do not fail assertion if re-setting the same lock (#13440)
authorArtur Signell <artur@vaadin.com>
Mon, 10 Mar 2014 11:55:39 +0000 (13:55 +0200)
committerLeif Åstrand <leif@vaadin.com>
Mon, 10 Mar 2014 12:35:46 +0000 (12:35 +0000)
Change-Id: I2e7e9dcf8739a04583d8e42a86a1fede36011813

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

index 216adce3c820f5e630df83f50fcba125f27eb33a..eda794438f6518a3d05e5f0d2b1dad30e492f297 100644 (file)
@@ -521,8 +521,13 @@ public abstract class VaadinService implements Serializable {
      *            The lock object
      */
     private void setSessionLock(WrappedSession wrappedSession, Lock lock) {
-        assert wrappedSession != null : "Can't set a lock for a null session";
-        assert wrappedSession.getAttribute(getLockAttributeName()) == null : "Changing the lock for a session is not allowed";
+        if (wrappedSession == null) {
+            throw new IllegalArgumentException(
+                    "Can't set a lock for a null session");
+        }
+        Object currentSessionLock = wrappedSession
+                .getAttribute(getLockAttributeName());
+        assert (currentSessionLock == null || currentSessionLock == lock) : "Changing the lock for a session is not allowed";
 
         wrappedSession.setAttribute(getLockAttributeName(), lock);
     }