From 8d141f4dcc229e997c2a711d37bd586cfb9fcfb7 Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Wed, 6 Dec 2023 17:43:41 +0100 Subject: [PATCH] feat(java): Update Java to version 21 (#420) --- .java-version | 2 +- build.gradle | 6 +++--- src/main/kotlin/com/ultratendency/kafka/ldap/LDAPConfig.kt | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.java-version b/.java-version index e000eb89..a8f5438c 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -17.0.9 +21.0.1 diff --git a/build.gradle b/build.gradle index 3d1d35a6..042bfd3e 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ group 'com.ultratendency.kafka.ldap' version '2.1.1' // x-release-please-version java { - sourceCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 } test { @@ -75,10 +75,10 @@ configurations.all { } compileKotlin { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() + kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString() } compileTestKotlin { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() + kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString() } test { diff --git a/src/main/kotlin/com/ultratendency/kafka/ldap/LDAPConfig.kt b/src/main/kotlin/com/ultratendency/kafka/ldap/LDAPConfig.kt index 63412bf9..f9f64a0b 100644 --- a/src/main/kotlin/com/ultratendency/kafka/ldap/LDAPConfig.kt +++ b/src/main/kotlin/com/ultratendency/kafka/ldap/LDAPConfig.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.KotlinFeature import com.fasterxml.jackson.module.kotlin.KotlinModule import org.slf4j.LoggerFactory import java.lang.IllegalArgumentException +import java.net.URI import java.net.URL import java.nio.file.FileSystemNotFoundException import java.nio.file.Files @@ -57,7 +58,7 @@ object LDAPConfig { init { cache = try { - loadConfig(ClassLoader.getSystemResource("ldapconfig.yaml") ?: URL("")) + loadConfig(ClassLoader.getSystemResource("ldapconfig.yaml") ?: URI("").toURL()) .also { log.info("LDAPConfig for classpath is cached") log.info("ldap configuration values: $it") @@ -70,7 +71,7 @@ object LDAPConfig { fun getBySource(configFile: String): Config { val prefix = if (System.getProperty("os.name").startsWith("Windows")) "file:/" else "file:" - return loadConfig(URL(prefix + System.getProperty("user.dir") + "/" + configFile)) + return loadConfig(URI(prefix + System.getProperty("user.dir") + "/" + configFile).toURL()) } fun getByClasspath(): Config = cache