From 823eb4ffab71587164814a80b363f110ae4e8071 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 18 Jun 2024 14:04:58 -0300 Subject: [PATCH] Improve logging relevant for WebDAV streams --- .../seedvault/transport/backup/FullBackup.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt index da10e517..eed8acab 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt @@ -20,7 +20,7 @@ import com.stevesoltys.seedvault.plugins.StoragePluginManager import com.stevesoltys.seedvault.plugins.isOutOfSpace import com.stevesoltys.seedvault.settings.SettingsManager import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager -import libcore.io.IoUtils.closeQuietly +import java.io.Closeable import java.io.EOFException import java.io.IOException import java.io.InputStream @@ -210,9 +210,9 @@ internal class FullBackup( val state = this.state ?: throw AssertionError("Trying to clear empty state.") return try { state.outputStream?.flush() - closeQuietly(state.outputStream) - closeQuietly(state.inputStream) - closeQuietly(state.inputFileDescriptor) + closeLogging(state.outputStream) + closeLogging(state.inputStream) + closeLogging(state.inputFileDescriptor) TRANSPORT_OK } catch (e: IOException) { Log.w(TAG, "Error when clearing state", e) @@ -222,4 +222,10 @@ internal class FullBackup( } } + private fun closeLogging(closable: Closeable?) = try { + closable?.close() + } catch (e: Exception) { + Log.w(TAG, "Error closing: ", e) + } + }