aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-ktor/src/main/kotlin/pl
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-server-ktor/src/main/kotlin/pl')
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt2
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt15
2 files changed, 11 insertions, 6 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 4d19e301..e4a48bc3 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -389,6 +389,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
* @param function a function of the receiver
* @param route a route
*/
+ @Suppress("EmptyCatchBlock")
protected actual inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
route: String?
@@ -449,6 +450,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
addRoute(HttpMethod.POST, "/kv/$routeDef") {
val service = call.injector.createChildInjector(DummyWsSessionModule()).getInstance(serviceClass.java)
val jsonRpcRequest = call.receive<JsonRpcRequest>()
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 3) {
val param1 = getParameter<String?>(jsonRpcRequest.params[0])
val param2 = getParameter<String?>(jsonRpcRequest.params[1])
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index f041465b..58636fcc 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -87,6 +87,7 @@ class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -113,6 +114,7 @@ class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -139,6 +141,7 @@ class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -164,11 +167,11 @@ class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
val str = p.text
- try {
- return OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}
@@ -190,11 +193,11 @@ class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
val str = p.text
- try {
- return OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}