aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-05-05 22:47:26 +0200
committerRobert Jaros <rjaros@finn.pl>2018-05-05 22:47:26 +0200
commit82d9528999273b75df1542c2effa764a762b10dd (patch)
tree132493aeda7c30a04e2ada4e7594cc20ed8c07e7
parent0c35c53941811f5e574fbdd9187cde97b0486002 (diff)
downloadkvision-82d9528999273b75df1542c2effa764a762b10dd.tar.gz
kvision-82d9528999273b75df1542c2effa764a762b10dd.tar.bz2
kvision-82d9528999273b75df1542c2effa764a762b10dd.zip
Style fixes.
-rw-r--r--kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt3
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt13
2 files changed, 7 insertions, 9 deletions
diff --git a/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
index 7b339621..6c1b47e7 100644
--- a/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
+++ b/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
@@ -26,6 +26,7 @@ import kotlinx.coroutines.experimental.Deferred
import kotlinx.coroutines.experimental.runBlocking
import org.jooby.Response
import org.jooby.Status
+import org.slf4j.Logger
import org.slf4j.LoggerFactory
/**
@@ -35,7 +36,7 @@ import org.slf4j.LoggerFactory
actual open class ServiceManager<out T> actual constructor(val service: T?) {
companion object {
- val LOG = LoggerFactory.getLogger(ServiceManager::class.java.name)
+ val LOG: Logger = LoggerFactory.getLogger(ServiceManager::class.java.name)
}
protected val routes: MutableList<JoobyServer.() -> Unit> = mutableListOf()
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 2f85a51f..7d9f4b05 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
@@ -59,14 +59,11 @@ open class CallAgent {
this.method = method.name
this.success =
{ data: dynamic, _: Any, _: Any ->
- if (data.id != jsonRpcRequest.id) {
- reject(Exception("Invalid response ID"))
- } else if (data.error != null) {
- reject(Exception(data.error.toString()))
- } else if (data.result != null) {
- resolve(data.result)
- } else {
- reject(Exception("Invalid response"))
+ when {
+ data.id != jsonRpcRequest.id -> reject(Exception("Invalid response ID"))
+ data.error != null -> reject(Exception(data.error.toString()))
+ data.result != null -> resolve(data.result)
+ else -> reject(Exception("Invalid response"))
}
}
this.error =