Improved error handling

pull/147/head
M66B 6 years ago
parent f1a171261f
commit 26a15ea06d

@ -1376,8 +1376,10 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
long id = args.getLong("id");
Uri uri = args.getParcelable("uri");
if ("file".equals(uri.getScheme()))
if ("file".equals(uri.getScheme())) {
Log.w("Save attachment uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
}
File file = EntityAttachment.getFile(context, id);

@ -1112,8 +1112,10 @@ public class FragmentCompose extends FragmentEx {
private static EntityAttachment addAttachment(Context context, long id, Uri uri,
boolean image) throws IOException {
if ("file".equals(uri.getScheme()))
if ("file".equals(uri.getScheme())) {
Log.w("Add attachment uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
}
EntityAttachment attachment = new EntityAttachment();
@ -1661,7 +1663,11 @@ public class FragmentCompose extends FragmentEx {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
// External app sending absolute file
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
}
};

@ -1009,8 +1009,10 @@ public class FragmentSetup extends FragmentEx {
Uri uri = args.getParcelable("uri");
String password = args.getString("password");
if ("file".equals(uri.getScheme()))
if ("file".equals(uri.getScheme())) {
Log.w("Export uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
}
OutputStream out = null;
try {
@ -1113,8 +1115,10 @@ public class FragmentSetup extends FragmentEx {
Uri uri = args.getParcelable("uri");
String password = args.getString("password");
if ("file".equals(uri.getScheme()))
if ("file".equals(uri.getScheme())) {
Log.w("Import uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
}
InputStream in = null;
try {

Loading…
Cancel
Save