mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-05 04:19:21 +01:00
Handle provider not found
This commit is contained in:
@@ -47,6 +47,7 @@ import com.sun.mail.util.SocketConnectException;
|
||||
import com.sun.mail.util.TraceOutputStream;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
@@ -450,6 +451,8 @@ public class EmailService implements AutoCloseable {
|
||||
try {
|
||||
authenticator.refreshToken(true);
|
||||
connect(host, port, auth, user, factory);
|
||||
} catch (FileNotFoundException ex1) {
|
||||
throw new AuthenticationFailedException(ex1.getMessage(), ex1);
|
||||
} catch (Exception ex1) {
|
||||
Log.e(ex1);
|
||||
String msg = ex.getMessage();
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.openid.appauth.NoClientAuthentication;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
@@ -146,7 +147,7 @@ public class ServiceAuthenticator extends Authenticator {
|
||||
}
|
||||
|
||||
private static void OAuthRefresh(Context context, String id, AuthState authState, boolean expire, long keep_alive)
|
||||
throws MessagingException {
|
||||
throws FileNotFoundException, MessagingException {
|
||||
try {
|
||||
Long expiration = authState.getAccessTokenExpirationTime();
|
||||
if (expiration != null && expiration - keep_alive < new Date().getTime()) {
|
||||
@@ -188,6 +189,8 @@ public class ServiceAuthenticator extends Authenticator {
|
||||
|
||||
if (holder.error != null)
|
||||
throw holder.error;
|
||||
} catch (FileNotFoundException ex) {
|
||||
throw ex; // provider not found
|
||||
} catch (Exception ex) {
|
||||
throw new MessagingException("OAuth refresh id=" + id, ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user