catch illegal state exception when copying file
This commit is contained in:
parent
ecbfe33e8d
commit
f7996a6c3c
|
@ -684,7 +684,7 @@ public class FileBackend {
|
||||||
} catch (final FileWriterException e) {
|
} catch (final FileWriterException e) {
|
||||||
cleanup(file);
|
cleanup(file);
|
||||||
throw new FileCopyException(R.string.error_unable_to_create_temporary_file);
|
throw new FileCopyException(R.string.error_unable_to_create_temporary_file);
|
||||||
} catch (final SecurityException e) {
|
} catch (final SecurityException | IllegalStateException e) {
|
||||||
cleanup(file);
|
cleanup(file);
|
||||||
throw new FileCopyException(R.string.error_security_exception);
|
throw new FileCopyException(R.string.error_security_exception);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
|
@ -1576,19 +1576,19 @@ public class FileBackend {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Integer.parseInt(value);
|
return Integer.parseInt(value);
|
||||||
} catch (final IllegalArgumentException e) {
|
} catch (final Exception e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dimensions getImageDimensions(File file) {
|
private Dimensions getImageDimensions(File file) {
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
final BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
options.inJustDecodeBounds = true;
|
options.inJustDecodeBounds = true;
|
||||||
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
|
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
|
||||||
int rotation = getRotation(file);
|
final int rotation = getRotation(file);
|
||||||
boolean rotated = rotation == 90 || rotation == 270;
|
final boolean rotated = rotation == 90 || rotation == 270;
|
||||||
int imageHeight = rotated ? options.outWidth : options.outHeight;
|
final int imageHeight = rotated ? options.outWidth : options.outHeight;
|
||||||
int imageWidth = rotated ? options.outHeight : options.outWidth;
|
final int imageWidth = rotated ? options.outHeight : options.outWidth;
|
||||||
return new Dimensions(imageHeight, imageWidth);
|
return new Dimensions(imageHeight, imageWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue