diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-14 13:06:41 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-14 13:06:41 +0100 |
commit | 9580586ff08041f2047ea191094f1e66f526933a (patch) | |
tree | ea9f8800b9666a0f8eb7395d2dba25cc0d611b59 /src/main/java/de | |
parent | 395c0f94edcbab6eac9e0f22a76ce1180de7c923 (diff) |
change location for wakelock while retrieving file size and changed name
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java | 5 |
1 files changed, 3 insertions, 2 deletions
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(); } } |