aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-04-28 09:35:10 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-04-28 09:35:10 +0200
commitb1843fb61a3f3c52ec99e3239a62d1976355f88c (patch)
tree46181975218ea456a18e9071c0ccc670a90fbaab /src/main
parentb10b8e2c50374c3f2f7d8f02b77f726c8921b721 (diff)
print stack trace on io error
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index ac169180..9ae56b04 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -155,9 +155,7 @@ public class FileBackend {
OutputStream os = null;
InputStream is = null;
try {
- if (!file.createNewFile()) {
- throw new FileCopyException(R.string.error_io_exception);
- }
+ file.createNewFile();
os = new FileOutputStream(file);
is = mXmppConnectionService.getContentResolver().openInputStream(uri);
byte[] buffer = new byte[1024];
@@ -166,7 +164,10 @@ public class FileBackend {
os.write(buffer, 0, length);
}
os.flush();
+ } catch(FileNotFoundException e) {
+ throw new FileCopyException(R.string.error_file_not_found);
} catch (IOException e) {
+ e.printStackTrace();
throw new FileCopyException(R.string.error_io_exception);
} finally {
close(os);
@@ -188,9 +189,7 @@ public class FileBackend {
InputStream is = null;
OutputStream os = null;
try {
- if (!file.createNewFile()) {
- throw new FileCopyException(R.string.error_io_exception);
- }
+ file.createNewFile();
is = mXmppConnectionService.getContentResolver().openInputStream(image);
os = new FileOutputStream(file);
@@ -223,6 +222,7 @@ public class FileBackend {
} catch (FileNotFoundException e) {
throw new FileCopyException(R.string.error_file_not_found);
} catch (IOException e) {
+ e.printStackTrace();
throw new FileCopyException(R.string.error_io_exception);
} catch (SecurityException e) {
throw new FileCopyException(R.string.error_security_exception_during_image_copy);