зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1289006 - Return gracefully if listFiles returns null in telemetry store. r=grisha
This changeset will correct the crash we're seeing in the bug. The docs support that File.listFiles can return null. MozReview-Commit-ID: FHYGErshhoP --HG-- extra : rebase_source : 15d0c4a3d283924627f1f97a1f99637244c49c08
This commit is contained in:
Родитель
cccfcddf71
Коммит
bd05d8b08b
|
@ -129,7 +129,15 @@ public class TelemetryJSONFilePingStore extends TelemetryPingStore {
|
|||
|
||||
@Override
|
||||
public ArrayList<TelemetryPing> getAllPings() {
|
||||
final List<File> files = Arrays.asList(storeDir.listFiles(uuidFilenameFilter));
|
||||
final File[] fileArray = storeDir.listFiles(uuidFilenameFilter);
|
||||
if (fileArray == null) {
|
||||
// Intentionally don't log all info for the store directory to prevent leaking the path.
|
||||
Log.w(LOGTAG, "listFiles unexpectedly returned null - unable to retrieve pings. Debug: exists? " +
|
||||
storeDir.exists() + "; directory? " + storeDir.isDirectory());
|
||||
return new ArrayList<>(1);
|
||||
}
|
||||
|
||||
final List<File> files = Arrays.asList(fileArray);
|
||||
Collections.sort(files, fileLastModifiedComparator); // oldest to newest
|
||||
final ArrayList<TelemetryPing> out = new ArrayList<>(files.size());
|
||||
for (final File file : files) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче