aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/http
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-11-15 15:43:04 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-11-15 15:43:04 +0100
commite84af512729cafa43ed831540d4406e1bb913689 (patch)
tree9044918a02dfc7449f526f99d2f4636ed28bb71a /src/main/java/eu/siacs/conversations/http
parentd61b00604d9a04c7f4a3933e42eee746583ba643 (diff)
distinguish between general i/o error and write exception when copying files
Diffstat (limited to 'src/main/java/eu/siacs/conversations/http')
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java11
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;