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 3c13349c26..3ebb31c289 100644 --- a/app/src/main/java/com/sun/mail/pop3/Protocol.java +++ b/app/src/main/java/com/sun/mail/pop3/Protocol.java @@ -486,10 +486,15 @@ class Protocol { doAuth(host, authzid, user, passwd); } catch (IOException ex) { // should never happen, ignore logger.log(Level.FINE, "AUTH " + mech + " failed", ex); + thrown = ex; } catch (Throwable t) { // crypto can't be initialized? logger.log(Level.FINE, "AUTH " + mech + " failed", t); thrown = t; } finally { + if (thrown instanceof IOException) { + close(); + throw (IOException) thrown; + } if (noauthdebug && isTracing()) logger.fine("AUTH " + mech + " " + (resp.ok ? "succeeded" : "failed"));