From cda433edc62e6ac472dd429e0e29e4039b354a85 Mon Sep 17 00:00:00 2001 From: Hosam Aly Date: Wed, 18 Sep 2024 15:35:46 +0100 Subject: [PATCH] Retry connecting to the API upon Socket exceptions Fixes #154 --- .../springdoc/openapi/gradle/plugin/OpenApiGeneratorTask.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGeneratorTask.kt b/src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGeneratorTask.kt index c46bc8b..7955eaa 100644 --- a/src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGeneratorTask.kt +++ b/src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGeneratorTask.kt @@ -21,8 +21,8 @@ import org.gradle.api.tasks.Optional import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction import java.io.FileInputStream -import java.net.ConnectException import java.net.HttpURLConnection +import java.net.SocketException import java.net.URL import java.security.KeyStore import java.security.SecureRandom @@ -95,7 +95,7 @@ open class OpenApiGeneratorTask : DefaultTask() { try { val isYaml = url.lowercase(Locale.getDefault()).matches(Regex(".+[./]yaml(/.+)*")) val sslContext = getCustomSslContext() - await ignoreException ConnectException::class withPollInterval Durations.ONE_SECOND atMost Duration.of( + await ignoreException SocketException::class withPollInterval Durations.ONE_SECOND atMost Duration.of( waitTimeInSeconds.get().toLong(), SECONDS ) until {