From 787804d20b30a87bf0f1c1782e6c9159ac5fea28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Tue, 18 Oct 2022 16:32:50 +0200 Subject: [PATCH] ThumbnailsCacheManager: null out cache when clearing it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cache is closed when clearing, so it becomes unusable. This way ThumbnailsCacheManager will work as expected Signed-off-by: Álvaro Brey --- .../owncloud/android/datamodel/ThumbnailsCacheManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index b91d858797..c3f241a258 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -77,11 +77,10 @@ import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.URLEncoder; import java.util.List; -import java.util.Locale; import androidx.annotation.NonNull; -import androidx.annotation.VisibleForTesting; import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import androidx.core.content.res.ResourcesCompat; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -152,7 +151,7 @@ public final class ThumbnailsCacheManager { mThumbnailCache = new DiskLruImageCache(diskCacheDir, DISK_CACHE_SIZE, mCompressFormat, mCompressQuality); } catch (Exception e) { - Log_OC.d(TAG, String.format(Locale.US, "Disk cache init failed: %s", e.getMessage())); + Log_OC.d(TAG, "Disk cache init failed", e); mThumbnailCache = null; } } @@ -1378,6 +1377,7 @@ public final class ThumbnailsCacheManager { @VisibleForTesting public static void clearCache() { mThumbnailCache.clearCache(); + mThumbnailCache = null; } private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageManager storageManager) {