From 350136f79757a2c3aa99502ba19cca63a432d9d9 Mon Sep 17 00:00:00 2001 From: serge-rider Date: Fri, 22 Nov 2024 12:39:05 +0100 Subject: [PATCH] CB-5584 VSC fix --- .../server/graphql/GraphQLLoggerUtil.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java index b42e1f28d9..76ab1a42ab 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/graphql/GraphQLLoggerUtil.java @@ -16,10 +16,12 @@ */ package io.cloudbeaver.server.graphql; +import io.cloudbeaver.model.app.BaseWebApplication; import io.cloudbeaver.model.session.WebSession; import io.cloudbeaver.server.CBApplication; import io.cloudbeaver.server.CBPlatform; import jakarta.servlet.http.HttpServletRequest; +import org.jkiss.code.Nullable; import org.jkiss.utils.CommonUtils; import java.util.Map; @@ -51,13 +53,18 @@ public static String getSessionId(HttpServletRequest request) { return session.getUserContext().getSmSessionId(); } + @Nullable private static WebSession getWebSession(HttpServletRequest request) { if (request.getSession() == null) { return null; } - return (WebSession) CBApplication.getInstance() - .getSessionManager() - .getSession(request.getSession().getId()); + + if (BaseWebApplication.getInstance() instanceof CBApplication cbApp) { + return (WebSession)cbApp.getSessionManager() + .getSession(request.getSession().getId()); + } else { + return null; + } } public static String buildLoggerMessage(String sessionId, String userId, Map variables) {