print stack trace on io error

This commit is contained in:
Daniel Gultsch 2015-04-28 09:35:10 +02:00
parent b10b8e2c50
commit b1843fb61a
1 changed files with 6 additions and 6 deletions

View File

@ -155,9 +155,7 @@ public class FileBackend {
OutputStream os = null; OutputStream os = null;
InputStream is = null; InputStream is = null;
try { try {
if (!file.createNewFile()) { file.createNewFile();
throw new FileCopyException(R.string.error_io_exception);
}
os = new FileOutputStream(file); os = new FileOutputStream(file);
is = mXmppConnectionService.getContentResolver().openInputStream(uri); is = mXmppConnectionService.getContentResolver().openInputStream(uri);
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
@ -166,7 +164,10 @@ public class FileBackend {
os.write(buffer, 0, length); os.write(buffer, 0, length);
} }
os.flush(); os.flush();
} catch(FileNotFoundException e) {
throw new FileCopyException(R.string.error_file_not_found);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
throw new FileCopyException(R.string.error_io_exception); throw new FileCopyException(R.string.error_io_exception);
} finally { } finally {
close(os); close(os);
@ -188,9 +189,7 @@ public class FileBackend {
InputStream is = null; InputStream is = null;
OutputStream os = null; OutputStream os = null;
try { try {
if (!file.createNewFile()) { file.createNewFile();
throw new FileCopyException(R.string.error_io_exception);
}
is = mXmppConnectionService.getContentResolver().openInputStream(image); is = mXmppConnectionService.getContentResolver().openInputStream(image);
os = new FileOutputStream(file); os = new FileOutputStream(file);
@ -223,6 +222,7 @@ public class FileBackend {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new FileCopyException(R.string.error_file_not_found); throw new FileCopyException(R.string.error_file_not_found);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
throw new FileCopyException(R.string.error_io_exception); throw new FileCopyException(R.string.error_io_exception);
} catch (SecurityException e) { } catch (SecurityException e) {
throw new FileCopyException(R.string.error_security_exception_during_image_copy); throw new FileCopyException(R.string.error_security_exception_during_image_copy);