summaryrefslogtreecommitdiffstats
path: root/services/backup
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2014-07-29 18:28:47 -0700
committerMichael Wright <michaelwr@google.com>2014-08-05 19:58:27 +0000
commit46db93404b27fe5ec121ab55527712e2a6692c7a (patch)
treed56c5250b6cddb252b8912bc93fe413726bfd890 /services/backup
parent40b8ef99a5132a970903e33d3c8ee087d0502a93 (diff)
downloadframeworks_base-46db93404b27fe5ec121ab55527712e2a6692c7a.zip
frameworks_base-46db93404b27fe5ec121ab55527712e2a6692c7a.tar.gz
frameworks_base-46db93404b27fe5ec121ab55527712e2a6692c7a.tar.bz2
Ensure backup schedule file is closed.
Change-Id: Ie4a62cda74815c67c62fb08e8df25a71d6102d4c
Diffstat (limited to 'services/backup')
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index d434d7a..c77c5b2 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -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);
}
}