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

Commit 3b463ca4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "ensure the opend resources are eventually closed when IOException happen." into main

parents 3b21bc62 19661358
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -354,10 +354,8 @@ class SnapshotPersistQueue {
            bitmap.recycle();

            final File file = mPersistInfoProvider.getHighResolutionBitmapFile(mId, mUserId);
            try {
                FileOutputStream fos = new FileOutputStream(file);
            try (FileOutputStream fos = new FileOutputStream(file)) {
                swBitmap.compress(JPEG, COMPRESS_QUALITY, fos);
                fos.close();
            } catch (IOException e) {
                Slog.e(TAG, "Unable to open " + file + " for persisting.", e);
                return false;
@@ -375,10 +373,8 @@ class SnapshotPersistQueue {
            swBitmap.recycle();

            final File lowResFile = mPersistInfoProvider.getLowResolutionBitmapFile(mId, mUserId);
            try {
                FileOutputStream lowResFos = new FileOutputStream(lowResFile);
            try (FileOutputStream lowResFos = new FileOutputStream(lowResFile)) {
                lowResBitmap.compress(JPEG, COMPRESS_QUALITY, lowResFos);
                lowResFos.close();
            } catch (IOException e) {
                Slog.e(TAG, "Unable to open " + lowResFile + " for persisting.", e);
                return false;