This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit ac1d78d6f11de9f8954c7d205679d145f052c4cf
Author: Alex Heneveld <[email protected]>
AuthorDate: Wed Mar 31 09:26:13 2021 +0100

    check cast on code review
---
 .../brooklyn/rest/util/MultiSessionAttributeAdapter.java       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
 
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
index aa6b635..8feebb6 100644
--- 
a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
+++ 
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
@@ -648,12 +648,16 @@ public class MultiSessionAttributeAdapter {
     }
 
     private static Session getSessionSafely(Handler h, String id) {
+        if (!(h instanceof SessionHandler)) {
+            log.warn("Unexpected Handler type "+h+" / "+(h==null ? "null" : 
h.getClass())+"; ignoring session lookup for "+id);
+            return null;
+        }
         if (((SessionHandler)h).getSessionCache()==null) {
             // suppress the log warning that the call to getSession can 
trigger, if racing during startup
-            log.debug("Skipping session reset expiration for "+id+" on "+h+" 
because session cache not initialized (yet)");
+            log.debug("Skipping session lookup for "+id+" on "+h+" because 
session cache not initialized (yet)");
             return null;
-        } else {
-            return ((SessionHandler) h).getSession(id);
         }
+        
+        return ((SessionHandler) h).getSession(id);
     }
 }

Reply via email to