From 6f3b84a7c0c4634b2b2a5f2abfb54268e0ff6c62 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 31 Jan 2023 22:03:33 -0800 Subject: [PATCH] Fixed potential resource leak --- src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt index 165647a..f61c56c 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt @@ -420,12 +420,12 @@ object Utils { val connection = this.openConnection() as HttpURLConnection connection.setRequestProperty( "User-Agent", - "Mozilla/5.0 (Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0" + "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" ) return if (connection.responseCode.isHttpSuccess()) { - UrlReaderResponse(connection.responseCode, connection.inputStream.bufferedReader().readText()) + UrlReaderResponse(connection.responseCode, connection.inputStream.bufferedReader().use { it.readText() }) } else { - UrlReaderResponse(connection.responseCode, connection.errorStream.bufferedReader().readText()) + UrlReaderResponse(connection.responseCode, connection.errorStream.bufferedReader().use { it.readText() }) } }