From b1843fb61a3f3c52ec99e3239a62d1976355f88c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 28 Apr 2015 09:35:10 +0200 Subject: print stack trace on io error --- .../java/eu/siacs/conversations/persistance/FileBackend.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/eu') 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); -- cgit v1.2.3