diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2022-09-07 17:29:51 +0300 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2022-09-07 17:29:51 +0300 |
commit | f7996a6c3c7fe23eeb2b005aec56eaf2b6e50397 (patch) | |
tree | 70ff8a6d37e7cd43911946cc3b00c6ecd3bd3350 | |
parent | ecbfe33e8d4b86603c343f6c92324211e7b76261 (diff) |
catch illegal state exception when copying file
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 0d1c03fcb..2d5496f2f 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -684,7 +684,7 @@ public class FileBackend { } catch (final FileWriterException e) { cleanup(file); throw new FileCopyException(R.string.error_unable_to_create_temporary_file); - } catch (final SecurityException e) { + } catch (final SecurityException | IllegalStateException e) { cleanup(file); throw new FileCopyException(R.string.error_security_exception); } catch (final IOException e) { @@ -1576,19 +1576,19 @@ public class FileBackend { return 0; } return Integer.parseInt(value); - } catch (final IllegalArgumentException e) { + } catch (final Exception e) { return 0; } } private Dimensions getImageDimensions(File file) { - BitmapFactory.Options options = new BitmapFactory.Options(); + final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(file.getAbsolutePath(), options); - int rotation = getRotation(file); - boolean rotated = rotation == 90 || rotation == 270; - int imageHeight = rotated ? options.outWidth : options.outHeight; - int imageWidth = rotated ? options.outHeight : options.outWidth; + final int rotation = getRotation(file); + final boolean rotated = rotation == 90 || rotation == 270; + final int imageHeight = rotated ? options.outWidth : options.outHeight; + final int imageWidth = rotated ? options.outHeight : options.outWidth; return new Dimensions(imageHeight, imageWidth); } |