diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java index b7440e531c..0e4be169b6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java @@ -62,6 +62,7 @@ public final class SimpleCache implements Cache { private static final HashSet lockedCacheDirs = new HashSet<>(); private static boolean cacheFolderLockingDisabled; + private static boolean cacheInitializationExceptionsDisabled; private final File cacheDir; private final CacheEvictor evictor; @@ -100,6 +101,16 @@ public final class SimpleCache implements Cache { lockedCacheDirs.clear(); } + /** + * Disables throwing of cache initialization exceptions. + * + * @deprecated Don't use this. Provided for problematic upgrade cases only. + */ + @Deprecated + public static void disableCacheInitializationExceptions() { + cacheInitializationExceptionsDisabled = true; + } + /** * Deletes all content belonging to a cache instance. * @@ -272,7 +283,7 @@ public final class SimpleCache implements Cache { * @throws CacheException If an error occurred during initialization. */ public synchronized void checkInitialization() throws CacheException { - if (initializationException != null) { + if (!cacheInitializationExceptionsDisabled && initializationException != null) { throw initializationException; } }