diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/dispatch/DispatchServiceManager.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/dispatch/DispatchServiceManager.java index f4e380cd7..26dacb4c0 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/dispatch/DispatchServiceManager.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/dispatch/DispatchServiceManager.java @@ -6,6 +6,7 @@ import com.google.gwt.place.shared.Place; import com.google.gwt.place.shared.PlaceController; import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.InvocationException; import com.google.web.bindery.event.shared.EventBus; @@ -31,6 +32,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import java.util.logging.Level; import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull; @@ -126,6 +128,7 @@ public , R extends Result> void execute(A action, final Disp callback.handleSubmittedForExecution(); if(action instanceof HasProjectId) { ProjectId projectId = ((HasProjectId) action).getProjectId(); + checkMakingACallForCurrentProject(projectId); ResultCache resultCache = getResultCache(projectId, eventBus); Optional result = resultCache.getCachedResult(action); if (result.isPresent()) { @@ -145,6 +148,24 @@ public , R extends Result> void execute(A action, final Disp // } } + private void checkMakingACallForCurrentProject(ProjectId projectId) { + Place place = placeController.getWhere(); + if(place instanceof HasProjectId) { + ProjectId placeProjectId = ((HasProjectId) place).getProjectId(); + if(!placeProjectId.equals(projectId)) { + logCurrentStack(); + } + } + } + + private static void logCurrentStack() { + try { + throw new RuntimeException("Mismatch"); + } catch (RuntimeException e) { + logger.log(Level.WARNING, "Mismatch of project Ids. If not deliberate this may indicated a bug somewhere.", e); + } + } + @SuppressWarnings("unchecked") private , R extends Result> void execAction(A action, DispatchServiceCallback callback) { requestCount++;