nestserau
12/17/2018, 9:59 AMkotlin.ClassCastException: null cannot be cast to io.ktor.client.call.HttpClientCall
at 0 test.kexe 0x000000010f30b976 kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 70
at 1 test.kexe 0x000000010f30b896 kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 70
at 2 test.kexe 0x000000010f3a8206 kfun:kotlin.ClassCastException.<init>(kotlin.String?)kotlin.ClassCastException + 70
at 3 test.kexe 0x000000010f3b2cfb ThrowClassCastException + 379
at 4 test.kexe 0x000000010f3dcb23 CheckInstance + 67
at 5 test.kexe 0x000000010f4e5706 kfun:io.ktor.client.HttpClient.$execute$COROUTINE$1.invokeSuspend(kotlin.Result<kotlin.Any?>)kotlin.Any? + 422
at 6 test.kexe 0x000000010f4e5802 kfun:io.ktor.client.HttpClient.execute(io.ktor.client.request.HttpRequestBuilder)io.ktor.client.call.HttpClientCall + 130
...
I’ve read earlier in this channel that it can be related to the version of Kotlin that I’m using (1.3.11), but the problem is, I cannot switch to 1.3.10 easily, because if I do, then it starts complaining about platform.CoreCrypto
not being available.
Does anyone know for sure that this error is related to Kotlin version or something else?
How I use HttpClient
is very simple:
suspend fun <T> send(message: MessageStrategy<T>): MessageResult<T> {
val request = message.buildRequest()
val token = session.state.sessionKey
...
val call = client.call(session.host) {
method = <http://HttpMethod.Post|HttpMethod.Post>
body = {
val encodedMessage = request.record.encode()
val bytes = ByteArray(encodedMessage.size) { encodedMessage[it].toByte() }
ByteArrayContent(bytes)
}
}
...
return ...
}
}
msink
12/17/2018, 10:20 AMnestserau
12/17/2018, 10:43 AM