From 36b581e3c1df63464d603b38e41fa9662991f3db Mon Sep 17 00:00:00 2001 From: tzugen Date: Tue, 16 Nov 2021 18:27:08 +0100 Subject: [PATCH] Rename UncaughtExceptionHandler --- .../org/moire/ultrasonic/activity/NavigationActivity.kt | 6 +++--- ...aughtExceptionHandler.kt => UncaughtExceptionHandler.kt} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/{SubsonicUncaughtExceptionHandler.kt => UncaughtExceptionHandler.kt} (91%) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/NavigationActivity.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/NavigationActivity.kt index 62040423..af38aaf4 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/NavigationActivity.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/NavigationActivity.kt @@ -51,7 +51,7 @@ import org.moire.ultrasonic.util.FileUtil import org.moire.ultrasonic.util.PermissionUtil import org.moire.ultrasonic.util.ServerColor import org.moire.ultrasonic.util.Settings -import org.moire.ultrasonic.util.SubsonicUncaughtExceptionHandler +import org.moire.ultrasonic.util.UncaughtExceptionHandler import org.moire.ultrasonic.util.Util import timber.log.Timber @@ -380,8 +380,8 @@ class NavigationActivity : AppCompatActivity() { private fun setUncaughtExceptionHandler() { val handler = Thread.getDefaultUncaughtExceptionHandler() - if (handler !is SubsonicUncaughtExceptionHandler) { - Thread.setDefaultUncaughtExceptionHandler(SubsonicUncaughtExceptionHandler(this)) + if (handler !is UncaughtExceptionHandler) { + Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler(this)) } } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SubsonicUncaughtExceptionHandler.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/UncaughtExceptionHandler.kt similarity index 91% rename from ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SubsonicUncaughtExceptionHandler.kt rename to ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/UncaughtExceptionHandler.kt index 658d2943..d0d713e1 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SubsonicUncaughtExceptionHandler.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/UncaughtExceptionHandler.kt @@ -9,7 +9,7 @@ import timber.log.Timber /** * Logs the stack trace of uncaught exceptions to a file on the SD card. */ -class SubsonicUncaughtExceptionHandler( +class UncaughtExceptionHandler( private val context: Context ) : Thread.UncaughtExceptionHandler { private val defaultHandler: Thread.UncaughtExceptionHandler? = @@ -31,8 +31,8 @@ class SubsonicUncaughtExceptionHandler( throwable.printStackTrace(printWriter) Timber.e(throwable, "Uncaught Exception! %s", logMessage) Timber.i("Stack trace written to %s", file) - } catch (x: Throwable) { - Timber.e(x, "Failed to write stack trace to %s", file) + } catch (all: Throwable) { + Timber.e(all, "Failed to write stack trace to %s", file) } finally { Util.close(printWriter) defaultHandler?.uncaughtException(thread, throwable)