aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-spring-boot/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-25 20:46:42 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-25 20:46:42 +0200
commitc78775aa2aaf76f9fa1404ff32a10fb8227f380e (patch)
treea6991e1f520e1ce54679b2194a756203a645f99e /kvision-modules/kvision-server-spring-boot/src
parenta990385dd3f2dbac4807b7a9498271efb3519c0d (diff)
downloadkvision-c78775aa2aaf76f9fa1404ff32a10fb8227f380e.tar.gz
kvision-c78775aa2aaf76f9fa1404ff32a10fb8227f380e.tar.bz2
kvision-c78775aa2aaf76f9fa1404ff32a10fb8227f380e.zip
Style fixes
Diffstat (limited to 'kvision-modules/kvision-server-spring-boot/src')
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt1
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt3
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt15
3 files changed, 13 insertions, 6 deletions
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 295ec8fb..fb6b6210 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -514,6 +514,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
val service = ctx.getBean(serviceClass.java)
initializeService(service, req)
val jsonRpcRequest = req.awaitBody<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-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
index 328e384d..7a9084dc 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
@@ -29,6 +29,7 @@ import org.springframework.security.web.server.util.matcher.ServerWebExchangeMat
/**
* A function to gather paths for spring security matchers.
*/
+@Suppress("SpreadOperator", "MaxLineLength")
fun ServerHttpSecurity.AuthorizeExchangeSpec.serviceMatchers(vararg services: KVServiceManager<*>): ServerHttpSecurity.AuthorizeExchangeSpec.Access {
return this.matchers(*getServerWebExchangeMatcher(*services))
}
@@ -36,6 +37,7 @@ fun ServerHttpSecurity.AuthorizeExchangeSpec.serviceMatchers(vararg services: KV
/**
* A function to gather paths for spring security matchers.
*/
+@Suppress("SpreadOperator")
fun serviceMatchers(vararg services: KVServiceManager<*>): ServerWebExchangeMatcher {
return ServerWebExchangeMatchers.matchers(*getServerWebExchangeMatcher(*services))
}
@@ -43,6 +45,7 @@ fun serviceMatchers(vararg services: KVServiceManager<*>): ServerWebExchangeMatc
/**
* A function to gather paths for spring security matchers.
*/
+@Suppress("SpreadOperator")
fun getServerWebExchangeMatcher(vararg services: KVServiceManager<*>): Array<ServerWebExchangeMatcher> {
val matchers = mutableListOf<ServerWebExchangeMatcher>()
val getPaths = services.flatMap { it.getRequests.keys }.toTypedArray()
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index f041465b..58636fcc 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-spring-boot/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
}
}
}