Improve logging relevant for WebDAV streams
This commit is contained in:
parent
d5717496d7
commit
823eb4ffab
1 changed files with 10 additions and 4 deletions
|
@ -20,7 +20,7 @@ import com.stevesoltys.seedvault.plugins.StoragePluginManager
|
||||||
import com.stevesoltys.seedvault.plugins.isOutOfSpace
|
import com.stevesoltys.seedvault.plugins.isOutOfSpace
|
||||||
import com.stevesoltys.seedvault.settings.SettingsManager
|
import com.stevesoltys.seedvault.settings.SettingsManager
|
||||||
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
||||||
import libcore.io.IoUtils.closeQuietly
|
import java.io.Closeable
|
||||||
import java.io.EOFException
|
import java.io.EOFException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
@ -210,9 +210,9 @@ internal class FullBackup(
|
||||||
val state = this.state ?: throw AssertionError("Trying to clear empty state.")
|
val state = this.state ?: throw AssertionError("Trying to clear empty state.")
|
||||||
return try {
|
return try {
|
||||||
state.outputStream?.flush()
|
state.outputStream?.flush()
|
||||||
closeQuietly(state.outputStream)
|
closeLogging(state.outputStream)
|
||||||
closeQuietly(state.inputStream)
|
closeLogging(state.inputStream)
|
||||||
closeQuietly(state.inputFileDescriptor)
|
closeLogging(state.inputFileDescriptor)
|
||||||
TRANSPORT_OK
|
TRANSPORT_OK
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.w(TAG, "Error when clearing state", e)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue