From 7354684c774eec66a862cebcfcf9b16ffed6a90d Mon Sep 17 00:00:00 2001 From: Tglman Date: Mon, 18 Sep 2023 13:06:44 +0100 Subject: [PATCH] fix: minor fix for lookup of remote session from thread local --- .../orient/client/remote/OStorageRemote.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java b/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java index b298bd9cd90..d06d7f323c7 100755 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java @@ -2066,9 +2066,9 @@ protected OStorageRemoteSession getCurrentSession() { ODatabaseDocumentInternal db = null; if (ODatabaseRecordThreadLocal.instance() != null) db = ODatabaseRecordThreadLocal.instance().getIfDefined(); - ODatabaseDocumentRemote remote = - (ODatabaseDocumentRemote) ODatabaseDocumentTxInternal.getInternal(db); - if (remote == null) return null; + ODatabaseDocumentInternal internal = ODatabaseDocumentTxInternal.getInternal(db); + if (internal == null || !(internal instanceof ODatabaseDocumentRemote)) return null; + ODatabaseDocumentRemote remote = (ODatabaseDocumentRemote) internal; OStorageRemoteSession session = remote.getSessionMetadata(); if (session == null) { session = new OStorageRemoteSession(sessionSerialId.decrementAndGet());