diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index bb5e006b8..f9aea9da8 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -29,6 +29,7 @@ import android.util.Log;
import android.util.LruCache;
import androidx.annotation.RequiresApi;
+import androidx.annotation.StringRes;
import androidx.core.content.FileProvider;
import java.io.ByteArrayOutputStream;
@@ -646,12 +647,13 @@ public class FileBackend {
} catch (IOException e) {
throw new FileWriterException();
}
- } catch (FileNotFoundException e) {
+ } catch (final FileNotFoundException e) {
throw new FileCopyException(R.string.error_file_not_found);
- } catch (FileWriterException e) {
+ } catch (final FileWriterException e) {
throw new FileCopyException(R.string.error_unable_to_create_temporary_file);
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (final SecurityException e) {
+ throw new FileCopyException(R.string.error_security_exception);
+ } catch (final IOException e) {
throw new FileCopyException(R.string.error_io_exception);
} finally {
close(os);
@@ -1462,11 +1464,11 @@ public class FileBackend {
public static class FileCopyException extends Exception {
private final int resId;
- private FileCopyException(int resId) {
+ private FileCopyException(@StringRes int resId) {
this.resId = resId;
}
- public int getResId() {
+ public @StringRes int getResId() {
return resId;
}
}
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 493a9dd8b..e96b62066 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -148,6 +148,7 @@
File not found
General I/O error. Maybe you ran out of storage space?
The app you used to select this image did not provide enough permissions to read the file.\n\nUse a different file manager to choose an image.
+ The app you used to share this file did not provide enough permissions.
Unknown
Temporarily disabled
Online