Merge pull request #8459 from WonderzGmbH:fix/8253-cache-exception

PiperOrigin-RevId: 352450607
This commit is contained in:
Oliver Woodman 2021-01-18 22:00:46 +00:00
commit 0c22810a7b

View File

@ -837,7 +837,8 @@ public final class SimpleCache implements Cache {
}
private static void createCacheDirectories(File cacheDir) throws CacheException {
if (!cacheDir.mkdirs()) {
// If mkdirs() returns false, double check that the directory doesn't exist before throwing.
if (!cacheDir.mkdirs() && !cacheDir.isDirectory()) {
String message = "Failed to create cache directory: " + cacheDir;
Log.e(TAG, message);
throw new CacheException(message);