diff --git a/app/src/main/java/com/sun/mail/pop3/POP3Store.java b/app/src/main/java/com/sun/mail/pop3/POP3Store.java index 98c63d0dc8..dcc8887bd7 100644 --- a/app/src/main/java/com/sun/mail/pop3/POP3Store.java +++ b/app/src/main/java/com/sun/mail/pop3/POP3Store.java @@ -288,7 +288,10 @@ public class POP3Store extends Store { } catch (EOFException ex) { throw cleanupAndThrow(p, ex); } catch (Exception ex) { - throw cleanupAndThrow(p, new EOFException(ex.getMessage())); + if (ex.getCause() instanceof IOException) + throw cleanupAndThrow(p, (IOException) ex.getCause()); + else + throw cleanupAndThrow(p, new EOFException(ex.getMessage())); } @@ -428,10 +431,14 @@ public class POP3Store extends Store { // only the first supported and enabled mechanism is used logger.log(Level.FINE, "Using mechanism {0}", m); - String msg = - p.authenticate(m, host, authzid, user, passwd); - if (msg != null) - throw new AuthenticationFailedException(msg); + try { + String msg = + p.authenticate(m, host, authzid, user, passwd); + if (msg != null) + throw new AuthenticationFailedException(msg); + } catch (IOException ex) { + throw new AuthenticationFailedException(m, ex); + } return true; } diff --git a/app/src/main/java/com/sun/mail/pop3/Protocol.java b/app/src/main/java/com/sun/mail/pop3/Protocol.java index d7735114da..3c13349c26 100644 --- a/app/src/main/java/com/sun/mail/pop3/Protocol.java +++ b/app/src/main/java/com/sun/mail/pop3/Protocol.java @@ -296,7 +296,7 @@ class Protocol { */ synchronized String authenticate(String mech, String host, String authzid, - String user, String passwd) { + String user, String passwd) throws IOException { Authenticator a = authenticators.get(mech.toUpperCase(Locale.ENGLISH)); if (a == null) return "No such authentication mechanism: " + mech; @@ -305,7 +305,7 @@ class Protocol { return "login failed"; return null; } catch (IOException ex) { - return ex.getMessage(); + throw ex; } }