Hide FolderClosedIOException

This commit is contained in:
M66B
2019-04-25 20:40:37 +02:00
parent 07d18e4164
commit 88a0452803
3 changed files with 8 additions and 12 deletions

View File

@@ -23,6 +23,8 @@ import android.content.Context;
import android.text.TextUtils;
import android.webkit.MimeTypeMap;
import com.sun.mail.util.FolderClosedIOException;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@@ -724,7 +726,7 @@ public class MessageHelper {
private List<AttachmentPart> attachments = new ArrayList<>();
private ArrayList<String> warnings = new ArrayList<>();
String getHtml(Context context) throws MessagingException, IOException {
String getHtml(Context context) throws MessagingException {
if (plain == null && html == null) {
warnings.add(context.getString(R.string.title_no_body));
return null;
@@ -743,12 +745,10 @@ public class MessageHelper {
result = readStream((InputStream) content, "UTF-8");
else
result = content.toString();
} catch (MessagingException ex) {
// Including FolderClosedException
throw ex;
} catch (IOException ex) {
// Including FolderClosedIOException
} catch (FolderClosedException ex) {
throw ex;
} catch (FolderClosedIOException ex) {
throw new FolderClosedException(ex.getFolder(), "getHtml", ex);
} catch (Throwable ex) {
Log.w(ex);
text = true;
@@ -876,6 +876,8 @@ public class MessageHelper {
db.attachment().setDownloaded(id, size);
Log.i("Downloaded attachment size=" + size);
} catch (FolderClosedIOException ex) {
throw new FolderClosedException(ex.getFolder(), "downloadAttachment", ex);
} catch (Throwable ex) {
// Reset progress on failure
db.attachment().setError(id, Helper.formatThrowable(ex));