From 25004a4842ec5de00d8721778c3ab3fd03b85196 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Wed, 11 Jan 2023 02:19:00 +0100 Subject: [PATCH] [Gradle] Fix failures in reporting were saved effectively statically --- .../kotlin/gradle/report/HttpService.kt | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/report/HttpService.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/report/HttpService.kt index 1510a3a0a79..eb508516a78 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/report/HttpService.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/report/HttpService.kt @@ -25,21 +25,19 @@ class HttpReportServiceImpl( ) : HttpReportService, Serializable { constructor(httpSettings: HttpReportSettings) : this(httpSettings.url, httpSettings.password, httpSettings.user) - companion object { - private var invalidUrl = false - private var requestPreviousFailed = false + private var invalidUrl = false + private var requestPreviousFailed = false - private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) { - val isResponseBad = connection.responseCode !in 200..299 - if (isResponseBad) { - val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}" - if (!requestPreviousFailed) { - log.warn(message) - } else { - log.debug(message) - } - requestPreviousFailed = true + private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) { + val isResponseBad = connection.responseCode !in 200..299 + if (isResponseBad) { + val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}" + if (!requestPreviousFailed) { + log.warn(message) + } else { + log.debug(message) } + requestPreviousFailed = true } }