mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
Fix linting warnings (#9701)
* fix: VariableNaming warnings
* fix: MatchingDeclarationName warnings
* fix: SwallowedException warnings
* fix: UseRequire warnings
* Revert "fix: MatchingDeclarationName warnings"
This reverts commit 9475af5052
.
This commit is contained in:
parent
3c76e2bc64
commit
5f8c675512
@ -183,7 +183,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
|||||||
val b: VersionResponse = r.body()
|
val b: VersionResponse = r.body()
|
||||||
b.version == 2
|
b.version == 2
|
||||||
}
|
}
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
false
|
false
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Log.error("Unexpected exception calling version endpoint for '$baseUrl': $e")
|
Log.error("Unexpected exception calling version endpoint for '$baseUrl': $e")
|
||||||
@ -204,7 +204,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
|||||||
val b: ApiErrorResponse = r.body()
|
val b: ApiErrorResponse = r.body()
|
||||||
b.statusCode == ApiStatusCode.Unauthenticated
|
b.statusCode == ApiStatusCode.Unauthenticated
|
||||||
}
|
}
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
false
|
false
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Log.error("Unexpected exception calling WebSocket endpoint for '$baseUrl': $e")
|
Log.error("Unexpected exception calling WebSocket endpoint for '$baseUrl': $e")
|
||||||
@ -339,9 +339,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
|||||||
* This function may also throw arbitrary exceptions for network failures.
|
* This function may also throw arbitrary exceptions for network failures.
|
||||||
*/
|
*/
|
||||||
suspend fun awaitPing(size: Int = 2, timeout: Long? = null): Double? {
|
suspend fun awaitPing(size: Int = 2, timeout: Long? = null): Double? {
|
||||||
if (size < 2) {
|
require(size < 2) { "Size too small to identify ping responses uniquely" }
|
||||||
throw IllegalArgumentException("Size too small to identify ping responses uniquely")
|
|
||||||
}
|
|
||||||
val body = ByteArray(size)
|
val body = ByteArray(size)
|
||||||
Random().nextBytes(body)
|
Random().nextBytes(body)
|
||||||
|
|
||||||
@ -371,7 +369,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
|||||||
throw exception
|
throw exception
|
||||||
}
|
}
|
||||||
}.toDouble() / 10e6
|
}.toDouble() / 10e6
|
||||||
} catch (c: ClosedReceiveChannelException) {
|
} catch (_: ClosedReceiveChannelException) {
|
||||||
return null
|
return null
|
||||||
} finally {
|
} finally {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
@ -448,7 +446,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
|||||||
Concurrency.run {
|
Concurrency.run {
|
||||||
try {
|
try {
|
||||||
c.send((msg as WebSocketMessageWithContent).content)
|
c.send((msg as WebSocketMessageWithContent).content)
|
||||||
} catch (closed: ClosedSendChannelException) {
|
} catch (_: ClosedSendChannelException) {
|
||||||
delay(10)
|
delay(10)
|
||||||
eventChannelList.remove(c)
|
eventChannelList.remove(c)
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
|
@ -50,7 +50,7 @@ class OnlineMultiplayerServer(
|
|||||||
if (result.isNotEmpty()) {
|
if (result.isNotEmpty()) {
|
||||||
featureSet = try {
|
featureSet = try {
|
||||||
json().fromJson(ServerFeatureSet::class.java, result)
|
json().fromJson(ServerFeatureSet::class.java, result)
|
||||||
} catch (ex: Exception) {
|
} catch (_: Exception) {
|
||||||
// The server does not support server feature set - not an error!
|
// The server does not support server feature set - not an error!
|
||||||
ServerFeatureSet()
|
ServerFeatureSet()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user