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

Commit 46db9340 authored by Michael Wright's avatar Michael Wright
Browse files

Ensure backup schedule file is closed.

Change-Id: Ie4a62cda74815c67c62fb08e8df25a71d6102d4c
parent 40b8ef99
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1266,10 +1266,13 @@ public class BackupManagerService extends IBackupManager.Stub {
        ArrayList<FullBackupEntry> schedule = null;
        synchronized (mQueueLock) {
            if (mFullBackupScheduleFile.exists()) {
                FileInputStream fstream = null;
                BufferedInputStream bufStream = null;
                DataInputStream in = null;
                try {
                    FileInputStream fstream = new FileInputStream(mFullBackupScheduleFile);
                    BufferedInputStream bufStream = new BufferedInputStream(fstream);
                    DataInputStream in = new DataInputStream(bufStream);
                    fstream = new FileInputStream(mFullBackupScheduleFile);
                    bufStream = new BufferedInputStream(fstream);
                    in = new DataInputStream(bufStream);

                    int version = in.readInt();
                    if (version != SCHEDULE_FILE_VERSION) {
@@ -1289,6 +1292,10 @@ public class BackupManagerService extends IBackupManager.Stub {
                    Slog.e(TAG, "Unable to read backup schedule", e);
                    mFullBackupScheduleFile.delete();
                    schedule = null;
                } finally {
                    IoUtils.closeQuietly(in);
                    IoUtils.closeQuietly(bufStream);
                    IoUtils.closeQuietly(fstream);
                }
            }