From bbc05aaba7ff341ff88e466d3d944d5718e5380e Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Tue, 24 Mar 2009 14:41:40 +0000
Subject: [PATCH] LMS-807 quick fix: there is still NPE in grids when session
 expires

SVN: 10349
---
 .../client/web/server/CommonClientService.java  | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java
index 186683f5550..ec17b310148 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java
@@ -146,11 +146,18 @@ public final class CommonClientService extends AbstractClientService implements
 
 	// ----------- export and listing with cache generic functionality
 
-	@SuppressWarnings("unchecked")
-	private final <K> IResultSetManager<K> getResultSetManager() {
-		return (IResultSetManager<K>) getHttpSession().getAttribute(
-				SessionConstants.OPENBIS_RESULT_SET_MANAGER);
-	}
+    @SuppressWarnings("unchecked")
+    private final <K> IResultSetManager<K> getResultSetManager()
+    {
+        HttpSession httpSession = getHttpSession();
+        if (httpSession == null)
+        {
+            throw new ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException(
+                    "Your session has expired, please log in again.");
+        }
+        return (IResultSetManager<K>) httpSession
+                .getAttribute(SessionConstants.OPENBIS_RESULT_SET_MANAGER);
+    }
 
 	@SuppressWarnings("unchecked")
 	private final <T> CacheManager<String, T> getExportManager() {
-- 
GitLab