From 2eaf7bc17cc9ce8487c632cd5061454689747643 Mon Sep 17 00:00:00 2001
From: Jan-Niclas Struewer <j.n.struewer@gmail.com>
Date: Wed, 31 Jul 2024 14:11:12 +0200
Subject: [PATCH] chore: remove deceprated use of URL construction

---
 .../fraunhofer/iem/app/configuration/OpenCodeApiProperties.kt | 3 ++-
 .../iem/app/configuration/OpenCodeGitlabApiProperties.kt      | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeApiProperties.kt b/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeApiProperties.kt
index 78acc823..f4fd6c9b 100644
--- a/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeApiProperties.kt
+++ b/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeApiProperties.kt
@@ -5,6 +5,7 @@ import jakarta.validation.constraints.NotBlank
 import org.springframework.boot.context.properties.ConfigurationProperties
 import org.springframework.boot.context.properties.ConfigurationPropertiesScan
 import org.springframework.validation.annotation.Validated
+import java.net.URI
 import java.net.URL
 
 @ConfigurationProperties(prefix = "opencode.api")
@@ -22,6 +23,6 @@ data class OpenCodeApiProperties(
     fun postConstruct() {
         // There is no try catch block around the operations on purpose!
         // We want to throw here if this operations fail.
-        URL(basePath).toURI()
+        URI.create(basePath)
     }
 }
diff --git a/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeGitlabApiProperties.kt b/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeGitlabApiProperties.kt
index 9f749e3c..b1c1e47c 100644
--- a/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeGitlabApiProperties.kt
+++ b/app/backend/src/main/kotlin/de/fraunhofer/iem/app/configuration/OpenCodeGitlabApiProperties.kt
@@ -4,7 +4,7 @@ import jakarta.annotation.PostConstruct
 import jakarta.validation.constraints.NotBlank
 import org.springframework.boot.context.properties.ConfigurationProperties
 import org.springframework.validation.annotation.Validated
-import java.net.URL
+import java.net.URI
 
 @ConfigurationProperties(prefix = "opencode")
 @Validated
@@ -21,7 +21,7 @@ data class OpenCodeGitlabApiProperties(
     fun postConstruct() {
         // There is no try catch block around the operations on purpose!
         // We want to throw here if this operations fail.
-        URL(host).toURI()
+        URI.create(host)
 
         if (analyzePrivateRepos && userName.isNullOrEmpty()) {
             throw Exception("To analyze private repositories a username must be set")
-- 
GitLab