Java 20 deprecation cleanup

This commit is contained in:
Erik C. Thauvin 2023-10-18 19:05:02 -07:00
parent e0a2c62600
commit 9bbd5fd03c
2 changed files with 5 additions and 4 deletions

View file

@ -41,7 +41,8 @@ import okhttp3.logging.HttpLoggingInterceptor
import org.json.JSONException
import org.json.JSONObject
import java.net.MalformedURLException
import java.net.URL
import java.net.URI
import java.net.URISyntaxException
import java.util.logging.Level
import java.util.logging.Logger
@ -163,9 +164,9 @@ object Utils {
fun String.isValidUrl(): Boolean {
if (this.isNotBlank()) {
try {
URL(this)
URI(this)
return true
} catch (e: MalformedURLException) {
} catch (e: URISyntaxException) {
if (logger.isLoggable(Level.WARNING)) {
logger.log(Level.WARNING, "Invalid URL: $this", e)
}