Temporarily disable cache UID creation.

PiperOrigin-RevId: 239476751
This commit is contained in:
olly 2019-03-20 21:35:20 +00:00 committed by Oliver Woodman
parent 3abf5ed143
commit 68ef1d3e97
2 changed files with 17 additions and 7 deletions

View File

@ -77,6 +77,9 @@ public interface Cache {
super(cause);
}
public CacheException(String message, Throwable cause) {
super(message, cause);
}
}
/**

View File

@ -557,16 +557,18 @@ public final class SimpleCache implements Cache {
private void initialize() {
if (!cacheDir.exists()) {
if (!cacheDir.mkdirs()) {
initializationException =
new CacheException("Failed to create cache directory: " + cacheDir);
String message = "Failed to create cache directory: " + cacheDir;
Log.e(TAG, message);
initializationException = new CacheException(message);
return;
}
}
File[] files = cacheDir.listFiles();
if (files == null) {
initializationException =
new CacheException("Failed to list cache directory files: " + cacheDir);
String message = "Failed to list cache directory files: " + cacheDir;
Log.e(TAG, message);
initializationException = new CacheException(message);
return;
}
@ -575,8 +577,11 @@ public final class SimpleCache implements Cache {
try {
uid = createUid(cacheDir);
} catch (IOException e) {
initializationException = new CacheException("Failed to create cache UID: " + cacheDir);
return;
String message = "Failed to create cache UID: " + cacheDir;
Log.e(TAG, message, e);
// TODO: Reinstate this only when a database index is used [Internal ref: b/128933265].
// initializationException = new CacheException(message, e);
// return;
}
}
@ -591,7 +596,9 @@ public final class SimpleCache implements Cache {
loadDirectory(cacheDir, /* isRoot= */ true, files, /* fileMetadata= */ null);
}
} catch (IOException e) {
initializationException = new CacheException(e);
String message = "Failed to initialize cache indices: " + cacheDir;
Log.e(TAG, message, e);
initializationException = new CacheException(message, e);
return;
}