diff --git a/wise-webapp/src/main/java/com/wisemapping/exceptions/SessionExpiredException.java b/wise-webapp/src/main/java/com/wisemapping/exceptions/SessionExpiredException.java index edff15a2..72b3d745 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exceptions/SessionExpiredException.java +++ b/wise-webapp/src/main/java/com/wisemapping/exceptions/SessionExpiredException.java @@ -26,8 +26,8 @@ public class SessionExpiredException public static final String MSG_KEY = "MINDMAP_TIMESTAMP_OUTDATED"; private User lastUpdater; - public SessionExpiredException(@NotNull User lastUpdater) { - super("Map has been updated by " + (lastUpdater != null ? lastUpdater.getEmail() : ""), Severity.FATAL); + public SessionExpiredException(@NotNull String debugInfo, @NotNull User lastUpdater) { + super(debugInfo, Severity.FATAL); this.lastUpdater = lastUpdater; } diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index 03d02d35..d427a624 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -188,15 +188,15 @@ public class MindmapController extends BaseController { if (lockInfo.getSession() == session) { // Timestamp might not be returned to the client. This try to cover this case, ignoring the client timestamp check. final User lastEditor = mindmap.getLastEditor(); - // lockInfo.getPreviousTimestamp() == timestamp : In case the timestap is not returned. Give a second chance. - if (outdated && (lockInfo.getPreviousTimestamp() != timestamp || lastEditor == null || !lastEditor.identityEquality(user))) { - throw new SessionExpiredException(lastEditor); + boolean editedBySameUser = lastEditor == null || user.identityEquality(lastEditor); + if (outdated && !editedBySameUser) { + throw new SessionExpiredException("Map has been updated by " + (lastEditor.getEmail()) + ",Timestamp:" + timestamp + "," + mindmap.getLastModificationTime().getTimeInMillis(), lastEditor); } } else if (outdated) { throw new MultipleSessionsOpenException("Sessions:" + session + ":" + lockInfo.getSession() + ",Timestamp: " + timestamp + ": " + lockInfo.getTimestamp()); } } else { - throw new SessionExpiredException(lockInfo.getUser()); + throw new SessionExpiredException("Different Users.", lockInfo.getUser()); } }