From 699e71e76b15081baf746c6ce9c9144f7e5f1ff9 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Mon, 30 Sep 2013 10:11:28 -0400 Subject: [PATCH] Trim trailing whitespace and organize imports --- src/main/java/com/gitblit/MailExecutor.java | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gitblit/MailExecutor.java b/src/main/java/com/gitblit/MailExecutor.java index c4e776a..b1ba3b6 100644 --- a/src/main/java/com/gitblit/MailExecutor.java +++ b/src/main/java/com/gitblit/MailExecutor.java @@ -41,9 +41,9 @@ /** * The mail executor handles sending email messages asynchronously from queue. - * + * * @author James Moger - * + * */ public class MailExecutor implements Runnable { @@ -90,6 +90,7 @@ if (!StringUtils.isEmpty(mailUser) && !StringUtils.isEmpty(mailPassword)) { // SMTP requires authentication session = Session.getInstance(props, new Authenticator() { + @Override protected PasswordAuthentication getPasswordAuthentication() { PasswordAuthentication passwordAuthentication = new PasswordAuthentication( mailUser, mailPassword); @@ -104,7 +105,7 @@ /** * Indicates if the mail executor can send emails. - * + * * @return true if the mail executor is ready to send emails */ public boolean isReady() { @@ -114,7 +115,7 @@ /** * Create a message. - * + * * @param toAddresses * @return a message */ @@ -124,7 +125,7 @@ /** * Create a message. - * + * * @param toAddresses * @return a message */ @@ -143,7 +144,7 @@ for (String address : toAddresses) { uniques.add(address.toLowerCase()); } - + Pattern validEmail = Pattern .compile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"); List<InternetAddress> tos = new ArrayList<InternetAddress>(); @@ -157,7 +158,7 @@ } catch (Throwable t) { } } - } + } message.setRecipients(Message.RecipientType.BCC, tos.toArray(new InternetAddress[tos.size()])); message.setSentDate(new Date()); @@ -169,7 +170,7 @@ /** * Returns the status of the mail queue. - * + * * @return true, if the queue is empty */ public boolean hasEmptyQueue() { @@ -178,7 +179,7 @@ /** * Queue's an email message to be sent. - * + * * @param message * @return true if the message was queued */ @@ -213,13 +214,13 @@ failures.add(message); } } - + // push the failures back onto the queue for the next cycle queue.addAll(failures); } } } - + public void sendNow(Message message) throws Exception { Transport.send(message); } -- Gitblit v1.9.1