/* 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.
*
* @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();