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

@ -28,7 +28,6 @@ import com.sun.mail.imap.IMAPStore;
import com.sun.mail.imap.protocol.FetchResponse;
import com.sun.mail.imap.protocol.IMAPProtocol;
import com.sun.mail.imap.protocol.UID;
import com.sun.mail.util.FolderClosedIOException;
import com.sun.mail.util.MailConnectException;
import org.json.JSONArray;
@ -1050,8 +1049,6 @@ class Core {
(IMAPMessage) isub[j], ids[from + j], state);
} catch (FolderClosedException ex) {
throw ex;
} catch (FolderClosedIOException ex) {
throw ex;
} catch (Throwable ex) {
Log.e(folder.name, ex);
} finally {

View File

@ -70,7 +70,6 @@ import androidx.preference.PreferenceManager;
import com.android.billingclient.api.BillingClient;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.sun.mail.imap.IMAPStore;
import com.sun.mail.util.FolderClosedIOException;
import com.sun.mail.util.MailConnectException;
import org.json.JSONException;
@ -320,8 +319,6 @@ public class Helper {
return null;
if (ex instanceof FolderClosedException)
return null;
if (ex instanceof FolderClosedIOException)
return null;
if (ex instanceof IllegalStateException)
// sync when store disconnected
return null;

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));