Propagate POP3 I/O errors

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

@ -288,7 +288,10 @@ public class POP3Store extends Store {
} catch (EOFException ex) { } catch (EOFException ex) {
throw cleanupAndThrow(p, ex); throw cleanupAndThrow(p, ex);
} catch (Exception 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 // only the first supported and enabled mechanism is used
logger.log(Level.FINE, "Using mechanism {0}", m); logger.log(Level.FINE, "Using mechanism {0}", m);
String msg = try {
p.authenticate(m, host, authzid, user, passwd); String msg =
if (msg != null) p.authenticate(m, host, authzid, user, passwd);
throw new AuthenticationFailedException(msg); if (msg != null)
throw new AuthenticationFailedException(msg);
} catch (IOException ex) {
throw new AuthenticationFailedException(m, ex);
}
return true; return true;
} }

@ -296,7 +296,7 @@ class Protocol {
*/ */
synchronized String authenticate(String mech, synchronized String authenticate(String mech,
String host, String authzid, String host, String authzid,
String user, String passwd) { String user, String passwd) throws IOException {
Authenticator a = authenticators.get(mech.toUpperCase(Locale.ENGLISH)); Authenticator a = authenticators.get(mech.toUpperCase(Locale.ENGLISH));
if (a == null) if (a == null)
return "No such authentication mechanism: " + mech; return "No such authentication mechanism: " + mech;
@ -305,7 +305,7 @@ class Protocol {
return "login failed"; return "login failed";
return null; return null;
} catch (IOException ex) { } catch (IOException ex) {
return ex.getMessage(); throw ex;
} }
} }

Loading…
Cancel
Save