Sam
10/07/2018, 9:52 PMkotlin.IllegalArgumentException: Charset ISO_8859_1 is not supported
otakusenpai
10/08/2018, 2:38 PMDias
10/08/2018, 3:28 PMotakusenpai
10/08/2018, 4:10 PMsocket = aSocket(ActorSelectorManager(ioCoroutineDispatcher)).tcp().connect(InetSocketAddress(address,port)).tls()
samir
10/08/2018, 8:18 PMApplicationStopping
, it works well with the tests but when I run the app locally with Intellij or by using ./gradlew run
the handler never gets called when I stop the app and I don’t see the logs Application stopping
& Application stopped
. Is there any way to make sure the handler always gets called even when stopping the app from intellij or with ./gradlew ?Dias
10/08/2018, 11:07 PMotakusenpai
10/09/2018, 4:55 AMoutput.writeByte(data.toByte())
cy
10/09/2018, 11:18 AM1.0.0-alpha-1
has been published
Kotlin 1.3.0-rc-131
(both JVM and Native)
kotlinx.coroutines 0.30.2-eap13
Migrated to coroutines structured concurrency (see `https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/basics.md#structured-concurrency`). Now all ktor handlers (including websocket) have relevant coroutiune scope.
Please note that it is important to use with 1.3.0-rc-131
and not mix with incompatible coroutines versions.orangy
10/09/2018, 1:25 PMalpha
build as soon as possible. We will stop 0.9.x
series and will not support Kotlin 1.2 very soon (because of coroutines). And release of Ktor 1.0 will go forward only with Kotlin 1.3.mp
10/09/2018, 4:16 PMmaven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
- Specified the kotlin version on the stdlib dependency (instead of letting the 1.2.71 plugin set it)
- Specified kotlin-reflect
dependency to set matching version (transitive dependency from jackson-module-kotlin
)
- Changed imports for coroutine types
- Also in gradle, added languageVersion and apiVersion:
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.3"
apiVersion = "1.3"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.3"
apiVersion = "1.3"
}
}
With that, I get:
w: Language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
and
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: Back-end (JVM) Internal error: Error type encountered: [ERROR : For SuccessOrFailure] (ErrorType).
Cause: Error type encountered: [ERROR : For SuccessOrFailure] (ErrorType).
File being compiled at position: (28,42) in /home/mbp/dev/.../Foo.kt
The root cause was thrown at: KotlinTypeMapper.java:114
File being compiled at position: file:///home/mbp/dev/.../Foo.kt
The root cause was thrown at: ExpressionCodegen.java:320
at org.jetbrains.kotlin.codegen.CompilationErrorHandler.lambda$static$0(CompilationErrorHandler.java:24)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:74)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:97)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:68)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39)
Am I missing a step?Jonas Bark
10/09/2018, 6:05 PMmp
10/09/2018, 6:28 PMResourceNotFoundException
) that is handled by an exception handler to respond with a 404, and there's a test that this works using withTestApplication
. On ktor-1.0.0-alpha-1, the test fails, seemingly because the exception bubbles up to the test itself.
Interestingly, if I alter the logic to throw RNFE()
directly inside the scope provided by the route (get("/foo")
), everything seems okay: the exception is thrown, handled, and responded to correctly, without crashing the test. However, in practice I have to use some blocking i/o, so I have:
val stuff = async(ioDispatcher) {
// blocking i/o that can throw RNFE
}.await()
and in that configuration, the exception crashes the test. I can see from logging that it is getting to the exception handler as well. Did I screw up structured coroutines (async
is called on the CoroutineScope
from get()
, not global), or is this a bug in the TestEngine
or something?peekandpoke
10/09/2018, 9:41 PMalex009
10/09/2018, 9:42 PM#1 0x0000000105008340 in ThrowException ()
#2 0x0000000105019b92 in kfun:kotlinx.io.charsets.Charset.Companion.forName(kotlin.String)kotlinx.io.charsets.Charset at /opt/teamcity-agent/work/22e3a7db6b861ba7/kotlinx-io-native/src/main/kotlin/kotlinx/io/charsets/CharsetNative.kt:20
#3 0x00000001050d2082 in kfun:io.ktor.client.response.HttpResponseConfig.<init>()io.ktor.client.response.HttpResponseConfig at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/src/io/ktor/client/response/HttpResponseConfig.kt:9
#4 0x00000001050d1fa4 in kfun:io.ktor.client.engine.HttpClientEngineConfig.<init>()io.ktor.client.engine.HttpClientEngineConfig at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/src/io/ktor/client/engine/HttpClientEngineConfig.kt:32
#5 0x00000001050d7e25 in kfun:io.ktor.client.engine.ios.Ios.create(kotlin.Function1<io.ktor.client.engine.HttpClientEngineConfig,kotlin.Unit>)io.ktor.client.engine.HttpClientEngine at /opt/teamcity-agent/work/a85294440dc5c6e:1
#6 0x00000001050c4083 in kfun:io.ktor.client.HttpClient(io.ktor.client.engine.HttpClientEngineFactory<#GENERIC_io.ktor.client.engine.HttpClientEngineConfig>;kotlin.Boolean;kotlin.Function1<io.ktor.client.HttpClientConfig<#GENERIC_io.ktor.client.engine.HttpClientEngineConfig>,kotlin.Unit>)Generic at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/src/io/ktor/client/HttpClient.kt:29
#7 0x00000001050c3f2f in kfun:io.ktor.client.HttpClient(kotlin.Boolean;kotlin.Function1<io.ktor.client.HttpClientConfig<#STAR>,kotlin.Unit>)io.ktor.client.HttpClient at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/ktor-client-core-ios/src/io/ktor/client/HttpClientIos.kt:8
#8 0x00000001050cfb1a in kfun:io.ktor.client.HttpClient$default(kotlin.Boolean;kotlin.Function1<io.ktor.client.HttpClientConfig<#STAR>,kotlin.Unit>;kotlin.Int)io.ktor.client.HttpClient at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/ktor-client-core-ios/src/io/ktor/client/HttpClientIos.kt:5
Yann Zaoui
10/10/2018, 4:51 AMContentTransformationException
when receiving my custom parameters class with missing fields, but instead Gson is assigning `0`/`null` to missing fields, so no exception is thrown. Jackson seems to have a @JsonProperty(required = true)
annotation, but I'd rather not repeat that everywhere if there's a better solution.voddan
10/10/2018, 11:26 AMget(...) is deprecated. Experimental coroutines support will be dropped in 1.4
in the simpliest code like
routing {
get("/") {
call.respondText("Hello World!", ContentType.Text.Plain)
}
get("/demo") {
call.respondText("HELLO WORLD!")
}
}
How do I get rid of those?otakusenpai
10/10/2018, 12:17 PMinput.read { byteBuffer }
Where input is a ByteReadChannel object ?serebit
10/10/2018, 5:57 PMotakusenpai
10/10/2018, 8:45 PMsuspend fun read(min: Int = 1, consumer: (ByteBuffer) -> Unit)
I'm trying to implement a usage of this function but I'm getting type mismatch error
Required: (ByteBuffer) -> Unit
Found: ByteBuffer!
Can someone give me an example or link to a code that uses (Int/String/Any) -> Unit ?otakusenpai
10/11/2018, 12:28 AMoverride suspend fun receiveData(): String? = coroutineScope {
var data: String? = null
try {
// 512 here is the MAX size of a IRC message
val bbToString = { bb: ByteBuffer ->
try {
var decoder = StandardCharsets.US_ASCII.newDecoder()
var charBuffer = decoder.decode(bb)
data = charBuffer.toString()
} catch(e: Throwable) {
throw e
}
}
input.read{ byteBuffer: ByteBuffer -> bbToString(byteBuffer) }
if(data == null) {
throw Exception("BasicConnection.kt: Didn't receive data from connection!")
}
println("Data size = ${data?.length}")
} catch(e: Throwable) {
e.printStackTrace()
}
data
}
I tried using this function call to receive data from the irc server, but it seems the input is receiving null after sometime...
How do I be sure that it is not my net speed(which is very slow) that is causing this drop in connection? Is it the function call's approach instead, for exampleand if so, how can it be improved?Dias
10/11/2018, 8:59 AMAndrey Z.
10/11/2018, 12:06 PMMarc Knaup
10/11/2018, 1:42 PMvoddan
10/11/2018, 3:35 PMenleur
10/11/2018, 4:25 PMmp
10/11/2018, 10:25 PMotakusenpai
10/12/2018, 9:37 AMjasoet
10/12/2018, 10:48 AMimport io.ktor.client.features.json.JsonFeature
is somehow not recognized.Dias
10/12/2018, 1:25 PMHttpClient(MockEngine) {
install(JWTAuth) {
}
}
doesn't allow to set up the engine itself. While setting up MockEngine and passing the instance to http client doesn't allow me to install the featureRenann
10/12/2018, 2:14 PMRenann
10/12/2018, 2:14 PMenleur
10/12/2018, 2:16 PMRenann
10/12/2018, 2:33 PM