Propagate POP3 I/O errors

pull/194/merge
M66B 3 years ago
parent 8a55f196fe
commit 1544b41f45

@ -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;
}

@ -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;
}
}

Loading…
Cancel
Save