diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index bb5e006b8d7ccd46c29f51b4bb1b3b30f5fc1087..f9aea9da88c891c704e6ecc27250b599e7fe68ea 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 493a9dd8bbfabf0cafe9e3d732b63ba8975b25e2..e96b62066b1532a1c8dfea5f1659b5259ecc04a7 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