remove cosmetic changes to security sensitive code: RepoUpdater

Security-sensitive code should not be changed unless there is a good reason
to do so.  It is too easy to introduce bugs.  This change does not address
an issue, so I'm reverting it. See comment in javadoc header for the class.

This reverts commit 2074718391c2c17a974218bc6565cce2dc05407e for just the
RepoUpdater.java file.
This commit is contained in:
Hans-Christoph Steiner 2016-05-02 20:35:38 +02:00
parent cbf1bda433
commit 77052c2b45

View File

@ -92,15 +92,6 @@ public class RepoUpdater {
return hasChanged;
}
private static void cleanupDownloader(Downloader d) {
if (d == null || d.outputFile == null) {
return;
}
if (!d.outputFile.delete()) {
Log.w(TAG, "Couldn't delete file: " + d.outputFile.getAbsolutePath());
}
}
private Downloader downloadIndex() throws UpdateException {
Downloader downloader = null;
try {
@ -115,7 +106,11 @@ public class RepoUpdater {
}
} catch (IOException e) {
cleanupDownloader(downloader);
if (downloader != null && downloader.outputFile != null) {
if (!downloader.outputFile.delete()) {
Log.w(TAG, "Couldn't delete file: " + downloader.outputFile.getAbsolutePath());
}
}
throw new UpdateException(repo, "Error getting index file", e);
} catch (InterruptedException e) {
@ -202,8 +197,10 @@ public class RepoUpdater {
} finally {
FDroidApp.enableSpongyCastleOnLollipop();
Utils.closeQuietly(indexInputStream);
if (downloadedFile != null && !downloadedFile.delete()) {
Log.w(TAG, "Couldn't delete file: " + downloadedFile.getAbsolutePath());
if (downloadedFile != null) {
if (!downloadedFile.delete()) {
Log.w(TAG, "Couldn't delete file: " + downloadedFile.getAbsolutePath());
}
}
}
}