Handle "User is authenticated but not connected"

pull/163/head
M66B 5 years ago
parent 58729f6285
commit 0215b97cea

@ -75,6 +75,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.sun.mail.iap.BadCommandException;
import com.sun.mail.iap.ConnectionException; import com.sun.mail.iap.ConnectionException;
import com.sun.mail.util.FolderClosedIOException; import com.sun.mail.util.FolderClosedIOException;
@ -495,6 +496,30 @@ public class Helper {
ex.getCause().getMessage().contains("Write error"))) ex.getCause().getMessage().contains("Write error")))
return null; return null;
// javax.mail.MessagingException: AU3 BAD User is authenticated but not connected.;
// nested exception is:
// com.sun.mail.iap.BadCommandException: AU3 BAD User is authenticated but not connected.
// javax.mail.MessagingException: AU3 BAD User is authenticated but not connected.;
// nested exception is:
// com.sun.mail.iap.BadCommandException: AU3 BAD User is authenticated but not connected.
// at com.sun.mail.imap.IMAPFolder.logoutAndThrow(SourceFile:1156)
// at com.sun.mail.imap.IMAPFolder.open(SourceFile:1063)
// at com.sun.mail.imap.IMAPFolder.open(SourceFile:977)
// at eu.faircode.email.ServiceSynchronize.monitorAccount(SourceFile:890)
// at eu.faircode.email.ServiceSynchronize.access$1500(SourceFile:85)
// at eu.faircode.email.ServiceSynchronize$7$1.run(SourceFile:627)
// at java.lang.Thread.run(Thread.java:764)
// Caused by: com.sun.mail.iap.BadCommandException: AU3 BAD User is authenticated but not connected.
// at com.sun.mail.iap.Protocol.handleResult(SourceFile:415)
// at com.sun.mail.imap.protocol.IMAPProtocol.select(SourceFile:1230)
// at com.sun.mail.imap.IMAPFolder.open(SourceFile:1034)
if (ex instanceof MessagingException &&
ex.getCause() instanceof BadCommandException &&
ex.getCause().getMessage() != null &&
ex.getCause().getMessage().contains("User is authenticated but not connected"))
return null;
if (ex instanceof IOException && if (ex instanceof IOException &&
ex.getCause() instanceof MessageRemovedException) ex.getCause() instanceof MessageRemovedException)
return null; return null;

@ -44,6 +44,7 @@ import androidx.core.content.ContextCompat;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.sun.mail.iap.BadCommandException;
import com.sun.mail.imap.IMAPFolder; import com.sun.mail.imap.IMAPFolder;
import java.text.DateFormat; import java.text.DateFormat;
@ -905,8 +906,12 @@ public class ServiceSynchronize extends ServiceBase {
db.folder().deleteFolder(folder.id); db.folder().deleteFolder(folder.id);
continue; continue;
} catch (MessagingException ex) { } catch (MessagingException ex) {
Log.w(folder.name, ex); Log.e(folder.name, ex);
db.folder().setFolderState(folder.id, null); db.folder().setFolderState(folder.id, null);
if (ex.getCause() instanceof BadCommandException)
throw ex;
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex)); db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
continue; continue;
} catch (Throwable ex) { } catch (Throwable ex) {

Loading…
Cancel
Save