Hide FolderClosedIOException

pull/155/head
M66B 6 years ago
parent 07d18e4164
commit 88a0452803

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

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

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

Loading…
Cancel
Save