Append random ID to temporary json file names

Multiple update list downloads can happen simultaneously. Use
unique file names for the temporary jsons to avoid conflicts.

Change-Id: I751c9838394e1f5aebbe359f61532947b429f39b
This commit is contained in:
Gabriele M
2018-04-20 21:21:43 +02:00
parent dc9890f09c
commit cc1ad0e827
2 changed files with 4 additions and 2 deletions

View File

@@ -39,6 +39,7 @@ import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class UpdatesCheckReceiver extends BroadcastReceiver {
@@ -74,7 +75,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
}
final File json = Utils.getCachedUpdateList(context);
final File jsonNew = new File(json.getAbsolutePath() + ".tmp");
final File jsonNew = new File(json.getAbsolutePath() + UUID.randomUUID());
String url = Utils.getServerURL(context);
DownloadClient.DownloadCallback callback = new DownloadClient.DownloadCallback() {
@Override