Skip to content

Commit

Permalink
Fix try-catch-finally-spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Nov 21, 2024
1 parent d455c8f commit 60befa6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package io.ktor.client.engine.cio
Expand All @@ -18,7 +18,6 @@ import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.ktor.utils.io.*
import kotlinx.coroutines.*
import kotlinx.coroutines.debug.junit5.*
import org.junit.jupiter.api.extension.*
Expand Down Expand Up @@ -102,7 +101,8 @@ class ConnectErrorsTest {
}
client.getInputStream().readBytes()
}
} catch (_: Exception) { }
} catch (_: Exception) {
}
}
assertEquals("OK", client.get("http://localhost:${serverSocket.localPort}/").body())
thread.join()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package io.ktor.client.tests.plugins
Expand Down Expand Up @@ -34,7 +34,8 @@ class WebSocketTest {
path = "/websocket"
) {
}
} catch (_: Throwable) {}
} catch (_: Throwable) {
}

assertEquals(443, port)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package io.ktor.server.cio.backend
Expand All @@ -12,11 +12,10 @@ import io.ktor.util.cio.*
import io.ktor.utils.io.*
import io.ktor.utils.io.charsets.*
import io.ktor.utils.io.core.*
import io.ktor.utils.io.errors.*
import kotlinx.coroutines.*
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.channels.*
import kotlinx.io.IOException
import kotlinx.io.*
import kotlin.time.*

/**
Expand Down Expand Up @@ -64,7 +63,8 @@ public fun CoroutineScope.startServerConnectionPipeline(
throw io
} catch (cancelled: CancellationException) {
throw cancelled
} catch (parseFailed: Throwable) { // try to write 400 Bad Request
} catch (parseFailed: Throwable) {
// try to write 400 Bad Request
respondBadRequest(actorChannel)
break // end pipeline loop
}
Expand Down Expand Up @@ -176,7 +176,8 @@ public fun CoroutineScope.startServerConnectionPipeline(

if (isLastHttpRequest(version, connectionOptions)) break
}
} catch (cause: IOException) { // already handled
} catch (cause: IOException) {
// already handled
coroutineContext.cancel()
} finally {
actorChannel.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ actual constructor(
starting.join()
@OptIn(ExperimentalCoroutinesApi::class)
starting.getCompletionExceptionOrNull()?.let { listOf(it) } ?: emptyList()
} catch (t: Throwable) { // InterruptedException?
} catch (t: Throwable) {
starting.cancel()
listOf(t)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ actual abstract class EngineTestBase<
starting.join()
@OptIn(ExperimentalCoroutinesApi::class)
starting.getCompletionExceptionOrNull()?.let { listOf(it) } ?: emptyList()
} catch (t: Throwable) { // InterruptedException?
} catch (t: Throwable) {
starting.cancel()
listOf(t)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ actual constructor(
starting.join()
@OptIn(ExperimentalCoroutinesApi::class)
starting.getCompletionExceptionOrNull()?.let { listOf(it) } ?: emptyList()
} catch (t: Throwable) { // InterruptedException?
} catch (t: Throwable) {
starting.cancel()
listOf(t)
}
Expand Down

0 comments on commit 60befa6

Please sign in to comment.