Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22562190 authored by Trong Vu's avatar Trong Vu Committed by Eric Jeong
Browse files

Catch Runtime Exception thrown by ProtoOutputStream.flush() api



Bug: 429041152
Flag: EXEMPT minor bug fix
Test: manual testing

When any IOException is received during flush operation of ProtoOutputStream, a RuntimeException is re-throwed. Failing to catch this exception resulted in exit of system_server process.

Signed-off-by: default avatarTrong Vu <tvu28@ford.com>
(cherry picked from https://android-review.googlesource.com/q/commit:cf70673f483d1438a11acfeb6553462bc6f23113)
Merged-In: If408334dfee39d9884f385ed34bf37d6d5104131
Change-Id: If408334dfee39d9884f385ed34bf37d6d5104131
parent db54b945
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -578,8 +578,10 @@ public class BootReceiver extends BroadcastReceiver {
        } catch (FileNotFoundException ex) {
            Slog.e(TAG, "failed to open for write: " + tombstoneProtoWithHeaders, ex);
            throw ex;
        } catch (IOException ex) {
            Slog.e(TAG, "IO exception during write: " + tombstoneProtoWithHeaders, ex);
        } catch (RuntimeException ex) {
            // in the method ProtoOutputStream.flush(), it tries to catch IOException
            // then re-throw RuntimeException, so better catch it here.
            Slog.e(TAG, "failed to flush proto tombstone: " + tombstoneProtoWithHeaders, ex);
        } finally {
            // Remove the temporary file and unlock the lock.
            if (tombstoneProtoWithHeaders != null) {