Code cleanups, javadoc.

This commit is contained in:
akwizgran
2019-06-14 11:31:59 +01:00
parent 34583e6d2d
commit d07b98eae1
4 changed files with 9 additions and 5 deletions

View File

@@ -59,7 +59,7 @@ class AttachmentCreationTask {
}
@IoExecutor
public void storeAttachments() {
void storeAttachments() {
for (Uri uri: uris) processUri(uri);
AttachmentCreator attachmentCreator = this.attachmentCreator;
if (!canceled && attachmentCreator != null)

View File

@@ -111,14 +111,14 @@ public class AttachmentCreator {
}
@IoExecutor
void onAttachmentError(Uri uri, Throwable t) {
void onAttachmentError(Uri uri, Exception e) {
// get error message
String errorMsg;
if (t instanceof UnsupportedMimeTypeException) {
String mimeType = ((UnsupportedMimeTypeException) t).getMimeType();
if (e instanceof UnsupportedMimeTypeException) {
String mimeType = ((UnsupportedMimeTypeException) e).getMimeType();
errorMsg = app.getString(
R.string.image_attach_error_invalid_mime_type, mimeType);
} else if (t instanceof FileTooBigException) {
} else if (e instanceof FileTooBigException) {
int mb = MAX_IMAGE_SIZE / 1024 / 1024;
errorMsg = app.getString(R.string.image_attach_error_too_big, mb);
} else {

View File

@@ -47,6 +47,7 @@ public class AttachmentRetriever {
private static final Logger LOG =
getLogger(AttachmentRetriever.class.getName());
private static final int READ_LIMIT = 1024 * 8192;
private final MessagingManager messagingManager;

View File

@@ -2,5 +2,8 @@ package org.briarproject.briar.api.messaging;
import java.io.IOException;
/**
* An exception that is thrown when a file is too big to attach to a message.
*/
public class FileTooBigException extends IOException {
}