21 lines
846 B
Markdown
21 lines
846 B
Markdown
#### 5.3 Broakkoppel exception swallowing (LAAG) — **OPGELOST**
|
|
|
|
**Bestand:** `SettingsActivity.kt:191-193`, `478`
|
|
|
|
```kotlin
|
|
try { unregisterReceiver(usbAttachedReceiver) } catch (e: Exception) {
|
|
Log.w(TAG, "Failed to unregister usbAttachedReceiver", e)
|
|
}
|
|
try { unregisterReceiver(usbPermissionReceiver) } catch (e: Exception) {
|
|
Log.w(TAG, "Failed to unregister usbPermissionReceiver", e)
|
|
}
|
|
try { unregisterReceiver(usbDetachedReceiver) } catch (e: Exception) {
|
|
Log.w(TAG, "Failed to unregister usbDetachedReceiver", e)
|
|
}
|
|
try { connection.close() } catch (e: Exception) {
|
|
Log.w(TAG, "Failed to close USB connection", e)
|
|
}
|
|
```
|
|
|
|
**Origineel:** Lege catch-blokken die exceptions.swallowen zonder logging.
|
|
**Opgelost:** Alle catches loggen nu een warning met de volledige exception ( inclusief stack trace) voor betere diagnose.
|