Yutong-1424 commented on code in PR #7319:
URL: https://github.com/apache/kyuubi/pull/7319#discussion_r2894320386
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala:
##########
@@ -205,8 +205,15 @@ private[v1] class AdminResource extends ApiRequestContext
with Logging {
throw new ForbiddenException(
s"$userName is not allowed to close the session $sessionHandleStr")
}
- fe.be.closeSession(SessionHandle.fromUUID(sessionHandleStr))
- Response.ok(s"Session $sessionHandleStr is closed successfully.").build()
+ try {
+ fe.be.closeSession(SessionHandle.fromUUID(sessionHandleStr))
+ Response.ok(s"Session $sessionHandleStr is closed successfully.").build()
+ } catch {
+ case e: org.apache.kyuubi.KyuubiSQLException
+ if e.getMessage != null && e.getMessage.startsWith("Invalid ") =>
Review Comment:
Thanks for the review @turboFei ! That's good point, using
getSessionOption() is much cleaner than catching the exception and matching on
the message string. I'll update both AdminResource and SessionsResource to
check session existence directly before calling closeSession. Will push the fix
shortly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]