错误:发现类型不匹配:数组[字节] [必需错误]:字节

时间:2019-05-16 14:03:07

标签: scala

所以我对Scala并不了解,所以我很少使用ScalaToJava转换器将一些代码转换为Scala。但是现在我遇到了这个错误。 发现[错误]:数组[字节] [错误]必填:字节

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 个答案:

没有答案