From 3f3ff5ffd70265482df3281638ef8b53d7d1f489 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 30 Mar 2018 10:54:25 +0200 Subject: [PATCH] further simplification of Downloader based on Uri missed this in df08e84e7829652d7999eee5451080a012b00a1e --- app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java | 6 ++---- .../java/org/fdroid/fdroid/net/DownloaderFactory.java | 9 ++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java b/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java index b961f3abb..a0ac78cbb 100644 --- a/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java +++ b/app/src/main/java/org/fdroid/fdroid/IndexV1Updater.java @@ -82,8 +82,7 @@ public class IndexV1Updater extends RepoUpdater { Downloader downloader = null; try { // read file name from file - final Uri dataUri = Uri.parse(indexUrl); - downloader = DownloaderFactory.create(context, dataUri.toString()); + downloader = DownloaderFactory.create(context, indexUrl); downloader.setCacheTag(repo.lastetag); downloader.setListener(downloadListener); downloader.download(); @@ -108,8 +107,7 @@ public class IndexV1Updater extends RepoUpdater { try { mirrorUrl = FDroidApp.getMirror(prevMirrorUrl, repo); prevMirrorUrl = mirrorUrl; - Uri dataUri2 = Uri.parse(mirrorUrl); - downloader = DownloaderFactory.create(context, dataUri2.toString()); + downloader = DownloaderFactory.create(context, mirrorUrl); downloader.setCacheTag(repo.lastetag); downloader.setListener(downloadListener); downloader.setTimeout(FDroidApp.getTimeout()); diff --git a/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java b/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java index 3d124eed9..4704ae279 100644 --- a/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java +++ b/app/src/main/java/org/fdroid/fdroid/net/DownloaderFactory.java @@ -20,19 +20,14 @@ public class DownloaderFactory { throws IOException { File destFile = File.createTempFile("dl-", "", context.getCacheDir()); destFile.deleteOnExit(); // this probably does nothing, but maybe... - return create(context, urlString, destFile); + Uri uri = Uri.parse(urlString); + return create(context, uri, destFile); } public static Downloader create(Context context, Uri uri, File destFile) throws IOException { - return create(context, uri.toString(), destFile); - } - - public static Downloader create(Context context, String urlString, File destFile) - throws IOException { Downloader downloader; - Uri uri = Uri.parse(urlString); String scheme = uri.getScheme(); if ("bluetooth".equals(scheme)) { downloader = new BluetoothDownloader(uri, destFile);