yaooqinn commented on a change in pull request #1317:
URL: https://github.com/apache/incubator-kyuubi/pull/1317#discussion_r742481167



##########
File path: 
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala
##########
@@ -88,12 +100,16 @@ private[v1] class SessionsResource extends 
ApiRequestContext {
   @DELETE
   @Path("{sessionHandle}")
   def closeSession(@PathParam("sessionHandle") sessionHandleStr: String): 
Response = {
+    val sessionHandle = getSessionHandle(sessionHandleStr)
+    backendService.closeSession(sessionHandle)
+    Response.ok().build()
+  }
+
+  def getSessionHandle(sessionHandleStr: String): SessionHandle = {
     val splitSessionHandle = sessionHandleStr.split("\\|")
     val handleIdentifier = new HandleIdentifier(
       UUID.fromString(splitSessionHandle(0)), 
UUID.fromString(splitSessionHandle(1)))
     val protocolVersion = 
TProtocolVersion.findByValue(splitSessionHandle(2).toInt)
-    val sessionHandle = new SessionHandle(handleIdentifier, protocolVersion)
-    backendService.closeSession(sessionHandle)
-    Response.ok().build()
+    new SessionHandle(handleIdentifier, protocolVersion)

Review comment:
       What if the sessionHandleStr is invalid
   
   splitSessionHandle‘s size is 1?
   
   or the generated sessionHandle is absent




-- 
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]


Reply via email to