From 9580586ff08041f2047ea191094f1e66f526933a Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 14 Jan 2017 13:06:41 +0100 Subject: change location for wakelock while retrieving file size and changed name --- src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/pixart/messenger/http') diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java index 2e3021735..ea0b5c1e8 100644 --- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java +++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java @@ -199,7 +199,7 @@ public class HttpDownloadConnection implements Transferable { } private long retrieveFileSize() throws IOException { - PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_" + message.getUuid()); + PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_filesize" + message.getUuid()); try { wakeLock.acquire(); Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive)); @@ -225,12 +225,13 @@ public class HttpDownloadConnection implements Transferable { if (contentLength == null) { throw new IOException("no content-length found in HEAD response"); } - wakeLock.release(); return Long.parseLong(contentLength, 10); } catch (IOException e) { throw e; } catch (NumberFormatException e) { throw new IOException(); + } finally { + wakeLock.release(); } } -- cgit v1.2.3