From: David ‘Bombe’ Roden Date: Thu, 8 Jun 2023 16:01:33 +0000 (+0200) Subject: 🎨 🔊 log string leading to exception X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=fffcc62456ab7639cf9195dba8fbe67d367d0bdb;p=Sone.git 🎨 🔊 log string leading to exception --- diff --git a/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt b/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt index fd3d8c8..e497fdc 100644 --- a/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt +++ b/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt @@ -104,7 +104,7 @@ class DefaultElementLoader(private val freenetInterface: FreenetInterface, ticke } -private fun String.decode() = URLDecoder.decode(this, "UTF-8")!! +private fun String.decode() = try { URLDecoder.decode(this, "UTF-8")!! } catch (e: RuntimeException) { freenet.support.Logger.error(DefaultElementLoader::class.java, "Could not decode %s!".format(this), e); throw e } private fun String.normalize() = Normalizer.normalize(this, Normalizer.Form.NFC)!! private val String?.emptyToNull get() = if (this == "") null else this