Simplification

pull/205/head
M66B 4 years ago
parent eefab1d75d
commit 0c25724063

@ -351,6 +351,8 @@ public class EmailService implements AutoCloseable {
String user, String password, String user, String password,
ServiceAuthenticator.IAuthenticated intf, ServiceAuthenticator.IAuthenticated intf,
String certificate, String fingerprint) throws MessagingException { String certificate, String fingerprint) throws MessagingException {
properties.put("fairemail.server", host);
SSLSocketFactoryService factory = null; SSLSocketFactoryService factory = null;
try { try {
PrivateKey key = null; PrivateKey key = null;
@ -478,7 +480,7 @@ public class EmailService implements AutoCloseable {
} }
EntityLog.log(context, "Connecting to " + main); EntityLog.log(context, "Connecting to " + main);
_connect(host, main, port, require_id, user, authenticator, factory); _connect(main, port, require_id, user, authenticator, factory);
} catch (UnknownHostException ex) { } catch (UnknownHostException ex) {
throw new MessagingException(ex.getMessage(), ex); throw new MessagingException(ex.getMessage(), ex);
} catch (MessagingException ex) { } catch (MessagingException ex) {
@ -552,7 +554,7 @@ public class EmailService implements AutoCloseable {
try { try {
EntityLog.log(context, "Falling back to " + iaddr); EntityLog.log(context, "Falling back to " + iaddr);
_connect(host, iaddr, port, require_id, user, authenticator, factory); _connect(iaddr, port, require_id, user, authenticator, factory);
return; return;
} catch (MessagingException ex1) { } catch (MessagingException ex1) {
ex = ex1; ex = ex1;
@ -570,10 +572,9 @@ public class EmailService implements AutoCloseable {
} }
private void _connect( private void _connect(
String host, InetAddress address, int port, boolean require_id, InetAddress address, int port, boolean require_id,
String user, Authenticator authenticator, String user, Authenticator authenticator,
SSLSocketFactoryService factory) throws MessagingException { SSLSocketFactoryService factory) throws MessagingException {
properties.setProperty("fairemail.server", host);
isession = Session.getInstance(properties, authenticator); isession = Session.getInstance(properties, authenticator);
isession.setDebug(debug || log); isession.setDebug(debug || log);

Loading…
Cancel
Save