diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index a9bffe3e..87f62706 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -25,6 +25,7 @@ import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.services.AbstractConnectionManager; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.utils.FileWriterException; public class HttpDownloadConnection implements Transferable { @@ -141,16 +142,12 @@ public class HttpDownloadConnection implements Transferable { mXmppConnectionService.updateConversationUi(); } - private class WriteException extends IOException { - - } - private void showToastForException(Exception e) { if (e instanceof java.net.UnknownHostException) { mXmppConnectionService.showErrorToastInUi(R.string.download_failed_server_not_found); } else if (e instanceof java.net.ConnectException) { mXmppConnectionService.showErrorToastInUi(R.string.download_failed_could_not_connect); - } else if (e instanceof WriteException) { + } else if (e instanceof FileWriterException) { mXmppConnectionService.showErrorToastInUi(R.string.download_failed_could_not_write_file); } else if (!(e instanceof CancellationException)) { mXmppConnectionService.showErrorToastInUi(R.string.download_failed_file_not_found); @@ -305,7 +302,7 @@ public class HttpDownloadConnection implements Transferable { try { os.write(buffer, 0, count); } catch (IOException e) { - throw new WriteException(); + throw new FileWriterException(); } updateProgress((int) ((((double) transmitted) / expected) * 100)); if (canceled) { @@ -315,7 +312,7 @@ public class HttpDownloadConnection implements Transferable { try { os.flush(); } catch (IOException e) { - throw new WriteException(); + throw new FileWriterException(); } } catch (CancellationException | IOException e) { throw e; |