summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-03-18 13:48:07 +0200
committerLeif Åstrand <leif@vaadin.com>2014-04-17 07:54:59 +0000
commit9f30eb285252348c349e9a759ac71098eb74a06a (patch)
tree074213f8a9f2842cb37684a3befd81362dfa99b9 /server
parent4015bd18e05cd26e73bfcd028bd261172ab82290 (diff)
downloadvaadin-framework-9f30eb285252348c349e9a759ac71098eb74a06a.tar.gz
vaadin-framework-9f30eb285252348c349e9a759ac71098eb74a06a.zip
Clarify lock check assert message if another session is locked (#13473)
Picking this to the 7.2 branch since the other part of the ticket was already included in 7.2. Change-Id: I1120ad5acd553e22db95e3635fffbd453fd26310 (cherry picked from commit 134c3bb96bfeaf1eab488e685f3b5dce3093e0ef)
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/AbstractClientConnector.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java
index a73ca3d985..9fc4a9c3a2 100644
--- a/server/src/com/vaadin/server/AbstractClientConnector.java
+++ b/server/src/com/vaadin/server/AbstractClientConnector.java
@@ -132,13 +132,22 @@ public abstract class AbstractClientConnector implements ClientConnector,
/* Documentation copied from interface */
@Override
public void markAsDirty() {
- assert getSession() == null || getSession().hasLock() : "Session must be locked when markAsDirty() is called";
+ assert getSession() == null || getSession().hasLock() : buildLockAssertMessage("markAsDirty()");
UI uI = getUI();
if (uI != null) {
uI.getConnectorTracker().markDirty(this);
}
}
+ private String buildLockAssertMessage(String method) {
+ if (VaadinService.isOtherSessionLocked(getSession())) {
+ return "The session of this connecor is not locked, but there is another session that is locked. "
+ + "This might be caused by accidentally using a connector that belongs to another session.";
+ } else {
+ return "Session must be locked when " + method + " is called";
+ }
+ }
+
/**
* Registers an RPC interface implementation for this component.
*
@@ -217,7 +226,7 @@ public abstract class AbstractClientConnector implements ClientConnector,
* @see #getState()
*/
protected SharedState getState(boolean markAsDirty) {
- assert getSession() == null || getSession().hasLock() : "Session must be locked when getState() is called";
+ assert getSession() == null || getSession().hasLock() : buildLockAssertMessage("getState()");
if (null == sharedState) {
sharedState = createState();