Annotate exceptions on check only

pull/182/head
M66B 4 years ago
parent 401692f7e0
commit edfa764765

@ -85,6 +85,7 @@ public class EmailService implements AutoCloseable {
private Context context; private Context context;
private String protocol; private String protocol;
private boolean insecure; private boolean insecure;
private int purpose;
private boolean harden; private boolean harden;
private boolean useip; private boolean useip;
private String ehlo; private String ehlo;
@ -136,6 +137,7 @@ public class EmailService implements AutoCloseable {
this.context = context.getApplicationContext(); this.context = context.getApplicationContext();
this.protocol = protocol; this.protocol = protocol;
this.insecure = insecure; this.insecure = insecure;
this.purpose = purpose;
this.debug = debug; this.debug = debug;
properties = MessageHelper.getSessionProperties(); properties = MessageHelper.getSessionProperties();
@ -369,6 +371,7 @@ public class EmailService implements AutoCloseable {
} else } else
throw ex; throw ex;
} catch (MessagingException ex) { } catch (MessagingException ex) {
if (purpose == PURPOSE_CHECK) {
if (port == 995 && !("pop3".equals(protocol) || "pop3s".equals(protocol))) if (port == 995 && !("pop3".equals(protocol) || "pop3s".equals(protocol)))
throw new MessagingException(context.getString(R.string.title_service_port), ex); throw new MessagingException(context.getString(R.string.title_service_port), ex);
else if (ex.getMessage() != null && else if (ex.getMessage() != null &&
@ -382,6 +385,8 @@ public class EmailService implements AutoCloseable {
throw new MessagingException(context.getString(R.string.title_service_protocol), ex); throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
else else
throw ex; throw ex;
} else
throw ex;
} }
} }

Loading…
Cancel
Save