From c9e5d8e1c36e6ae847041d0fb63a1356dd1d59fa Mon Sep 17 00:00:00 2001 From: Dzianis Lisiankou Date: Fri, 18 Aug 2023 14:16:44 +0300 Subject: [PATCH] Non-null assertion operator removed --- .../kotlin/eu/ibagroup/formainframe/api/ZosmfApiImpl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/eu/ibagroup/formainframe/api/ZosmfApiImpl.kt b/src/main/kotlin/eu/ibagroup/formainframe/api/ZosmfApiImpl.kt index 3959ba050..a541c9d42 100755 --- a/src/main/kotlin/eu/ibagroup/formainframe/api/ZosmfApiImpl.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/api/ZosmfApiImpl.kt @@ -76,14 +76,15 @@ class ZosmfApiImpl : ZosmfApi { useBytesConverter: Boolean ): Api { val zosmfUrl = ZosmfUrl(url, isAllowSelfSigned) + val defaultApi = Pair, MutableMap>(hashMapOf(), hashMapOf()) if (!apis.containsKey(apiClass)) { synchronized(apis) { if (!apis.containsKey(apiClass)) { - apis[apiClass] = Pair(hashMapOf(), hashMapOf()) + apis[apiClass] = defaultApi } } } - val apiClassMap = apis[apiClass]!! + val apiClassMap = apis[apiClass] ?: defaultApi synchronized(apiClassMap) { if (!useBytesConverter && !apiClassMap.first.containsKey(zosmfUrl)) { apiClassMap.first[zosmfUrl] = buildApi(zosmfUrl.url, getOkHttpClient(zosmfUrl.isAllowSelfSigned), apiClass) @@ -94,7 +95,6 @@ class ZosmfApiImpl : ZosmfApi { } return if (!useBytesConverter) apiClassMap.first[zosmfUrl] as Api else apiClassMap.second[zosmfUrl] as Api } - } private val gsonFactory = GsonConverterFactory.create(GsonBuilder().create())