So I don't know Scala that much I used ScalaToJava converter to convert some code into Scala But now I have this error.type mismatch; [error] found : Array[Byte] [error] required: Byte

def generateAuthTkt(username: String,
                  tokens: Array[String],
                  userData: Array[String],
                  encode: Boolean,
                  ignoreIP: Boolean,
                  ip: String,
                  secretKey: String,
                  timestampInSeconds: Long): String = {
val username: String =
  (if (StringUtils.isBlank(username)) StringUtils.EMPTY else 
username)
val tokens: Array[String] = (if (tokens == null) Array() else 
tokens)
val userData: Array[String] = (if (userData == null) Array() else 
userData)
var ipAddress: String = ip
if (ignoreIP || StringUtils.isBlank(ipAddress)) {
  ipAddress = "0.0.0.0"
}
val ipLong: Long = convertIPToLong(ipAddress).longValue()
val ipBytes: Array[Byte] = longToBytes(ipLong)
val tsBytes: Array[Byte] = longToBytes(timestampInSeconds)
val ipts: Array[Byte] = ArrayUtils.addAll(
  ArrayUtils.subarray(ipBytes, 4, 8),
  ArrayUtils.subarray(tsBytes, 4, 8))
//I am getting the error in the upper line 
var dataBytes: Array[Byte] = ArrayUtils.addAll(ipts, 
secretKey.getBytes)

0 Answers