From 2794f5376e92f617ceeb679d2827ffbd9e7bb058 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Thu, 18 Nov 2021 10:44:48 +0100 Subject: [PATCH] Cosmetics --- .../btools/routingapp/DownloadService.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java b/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java index b067697..94d9a82 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java @@ -192,9 +192,7 @@ public class DownloadService extends Service implements ProgressListener { { try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - TrafficStats.setThreadStatsTag(1); - } + TrafficStats.setThreadStatsTag(1); int slidx = surl.lastIndexOf( "segments4/" ); String name = surl.substring( slidx+10 ); @@ -397,17 +395,13 @@ public class DownloadService extends Service implements ProgressListener { { try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - TrafficStats.setThreadStatsTag(1); - } + TrafficStats.setThreadStatsTag(1); + + URL url = new URL(surl); + connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(5000); + connection.connect(); - if ( connection == null ) - { - URL url = new URL(surl); - connection = (HttpURLConnection) url.openConnection(); - connection.setConnectTimeout(5000); - connection.connect(); - } // expect HTTP 200 OK, so we don't mistakenly save error report // instead of the file if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {