zhouyifan279 commented on a change in pull request #1015:
URL: https://github.com/apache/incubator-kyuubi/pull/1015#discussion_r701608800



##########
File path: 
kyuubi-common/src/main/scala/org/apache/kyuubi/util/KyuubiHadoopUtils.scala
##########
@@ -33,4 +35,24 @@ object KyuubiHadoopUtils {
   def getServerPrincipal(principal: String): String = {
     SecurityUtil.getServerPrincipal(principal, "0.0.0.0")
   }
+
+  def encodeCredentials(creds: Credentials): String = {
+    val buf = new DataOutputBuffer
+    creds.write(buf)
+    val encoder = new Base64(0, null, false)
+    val raw = new Array[Byte](buf.getLength)
+    System.arraycopy(buf.getData, 0, raw, 0, buf.getLength)

Review comment:
       DataOutputBuffer's underlying byte array grows 1 times bigger each time 
when it is full. `DataOutputBuffer#getData` returns the underlying byte array 
and may contains extra bytes.




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