From 1149d8068fcd828b978a31d7cc0c7eeb7a48e81a Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Thu, 14 Jul 2011 07:41:38 +0000
Subject: [PATCH] [LMS-1719] more reliable handling of session expired
 exception in tests

SVN: 22134
---
 .../application/AbstractAsyncCallback.java       | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java
index db28dd4d6db..ee53cbd0ddd 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java
@@ -212,7 +212,7 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
         if (isIncompatibleServerException(caught))
         {
             String sessionExpiredMessage = getMessage(Dict.SESSION_EXPIRED_MESSAGE);
-            handleSessionTerminated(sessionExpiredMessage);
+            handleSessionTerminated(sessionExpiredMessage, caught);
             return;
         }
 
@@ -239,12 +239,7 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
         }
         if (caught instanceof InvalidSessionException)
         {
-            handleSessionTerminated(msg);
-            // only for tests
-            if (staticCallbackListener != DEFAULT_CALLBACK_LISTENER)
-            {
-                callbackListener.onFailureOf(viewContext, this, msg, caught);
-            }
+            handleSessionTerminated(msg, caught);
         } else
         {
             callbackListener.onFailureOf(viewContext, this, msg, caught);
@@ -281,7 +276,7 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
         }
     }
 
-    private void handleSessionTerminated(String msg)
+    private void handleSessionTerminated(String msg, Throwable caught)
     {
         if (viewContext.isSimpleOrEmbeddedMode())
         {
@@ -290,6 +285,11 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
         {
             showSessionTerminated(msg);
         }
+        // only for tests
+        if (staticCallbackListener != DEFAULT_CALLBACK_LISTENER)
+        {
+            callbackListener.onFailureOf(viewContext, this, msg, caught);
+        }
     }
 
     private void showSessionTerminated(String msg)
-- 
GitLab