Cosmetics

This commit is contained in:
afischerdev 2021-11-18 10:44:48 +01:00
parent 7fa59d65db
commit 2794f5376e

View file

@ -192,9 +192,7 @@ public class DownloadService extends Service implements ProgressListener {
{ {
try try
{ {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { TrafficStats.setThreadStatsTag(1);
TrafficStats.setThreadStatsTag(1);
}
int slidx = surl.lastIndexOf( "segments4/" ); int slidx = surl.lastIndexOf( "segments4/" );
String name = surl.substring( slidx+10 ); String name = surl.substring( slidx+10 );
@ -397,17 +395,13 @@ public class DownloadService extends Service implements ProgressListener {
{ {
try 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 // expect HTTP 200 OK, so we don't mistakenly save error report
// instead of the file // instead of the file
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {