diff --git a/pom.xml b/pom.xml index ad0aab8d..12eec2fd 100644 --- a/pom.xml +++ b/pom.xml @@ -25,15 +25,15 @@ 1.35 -SNAPSHOT 8 - 2.235.5 + 2.289.1 io.jenkins.tools.bom - bom-2.235.x - 918.vae501d2cdc99 + bom-2.289.x + 1075.v14bef33e5d7b import pom @@ -54,18 +54,15 @@ org.hamcrest hamcrest-core + + javax.annotation + javax.annotation-api + - - javax.mail - mail - 1.4.7 - provided - org.jenkins-ci.modules instance-identity - 2.2 provided @@ -101,6 +98,12 @@ org.jenkins-ci.plugins.workflow workflow-basic-steps test + + + org.jenkins-ci.plugins + mailer + + org.jenkins-ci.plugins.workflow @@ -157,7 +160,4 @@ https://repo.jenkins-ci.org/public/ - - clean hpi:run - diff --git a/src/main/java/hudson/tasks/MailSender.java b/src/main/java/hudson/tasks/MailSender.java index e56542e5..a84a9c03 100644 --- a/src/main/java/hudson/tasks/MailSender.java +++ b/src/main/java/hudson/tasks/MailSender.java @@ -39,8 +39,8 @@ import org.acegisecurity.userdetails.UsernameNotFoundException; import org.jenkinsci.plugins.displayurlapi.DisplayURLProvider; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; import javax.mail.Address; import javax.mail.MessagingException; import javax.mail.Transport; @@ -460,7 +460,7 @@ String getCulpritsOfEmailList(AbstractProject upstreamProject, AbstractBuild build) throws AddressException, UnsupportedEncodingException { Set users = build.getCulprits(); StringBuilder userEmails = new StringBuilder(); diff --git a/src/main/java/hudson/tasks/Mailer.java b/src/main/java/hudson/tasks/Mailer.java index ae1da71d..edaa6dc3 100644 --- a/src/main/java/hudson/tasks/Mailer.java +++ b/src/main/java/hudson/tasks/Mailer.java @@ -24,6 +24,7 @@ */ package hudson.tasks; +import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.Util; @@ -62,8 +63,6 @@ import java.util.logging.Logger; import java.util.regex.Pattern; import java.util.regex.Matcher; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; import javax.mail.Address; import javax.mail.Authenticator; import javax.mail.Message; @@ -215,8 +214,8 @@ public static InternetAddress StringToAddress(String strAddress, String charset) * @throws UnsupportedEncodingException Unsupported encoding * @since TODO */ - public static @Nonnull InternetAddress stringToAddress(@Nonnull String strAddress, - @Nonnull String charset) throws AddressException, UnsupportedEncodingException { + public static @NonNull InternetAddress stringToAddress(@NonNull String strAddress, + @NonNull String charset) throws AddressException, UnsupportedEncodingException { Matcher m = ADDRESS_PATTERN.matcher(strAddress); if(!m.matches()) { return new InternetAddress(strAddress); diff --git a/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java b/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java index 7c574dcf..3e3c8b54 100644 --- a/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java +++ b/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java @@ -33,7 +33,7 @@ import org.apache.commons.lang.StringUtils; import org.jenkinsci.main.modules.instance_identity.InstanceIdentity; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import javax.mail.Address; import javax.mail.BodyPart; import javax.mail.Message; @@ -94,12 +94,12 @@ public MimeMessageBuilder() { } } - public MimeMessageBuilder setCharset(@Nonnull String charset) { + public MimeMessageBuilder setCharset(@NonNull String charset) { this.charset = charset; return this; } - public MimeMessageBuilder setMimeType(@Nonnull String mimeType) { + public MimeMessageBuilder setMimeType(@NonNull String mimeType) { this.mimeType = mimeType; return this; } @@ -109,17 +109,17 @@ public MimeMessageBuilder setListener(TaskListener listener) { return this; } - public MimeMessageBuilder setDefaultSuffix(@Nonnull String defaultSuffix) { + public MimeMessageBuilder setDefaultSuffix(@NonNull String defaultSuffix) { this.defaultSuffix = defaultSuffix; return this; } - public MimeMessageBuilder setFrom(@Nonnull String from) { + public MimeMessageBuilder setFrom(@NonNull String from) { this.from = from; return this; } - public MimeMessageBuilder setReplyTo(@Nonnull String replyTo) { + public MimeMessageBuilder setReplyTo(@NonNull String replyTo) { try { final List addresses = toNormalizedAddresses(replyTo); // Done after to leave the current value untouched if there is a parsing error. @@ -131,7 +131,7 @@ public MimeMessageBuilder setReplyTo(@Nonnull String replyTo) { return this; } - public MimeMessageBuilder addReplyTo(@Nonnull String replyTo) { + public MimeMessageBuilder addReplyTo(@NonNull String replyTo) { try { this.replyTo.addAll(toNormalizedAddresses(replyTo)); } catch(UnsupportedEncodingException e) { @@ -141,12 +141,12 @@ public MimeMessageBuilder addReplyTo(@Nonnull String replyTo) { } - public MimeMessageBuilder setSubject(@Nonnull String subject) { + public MimeMessageBuilder setSubject(@NonNull String subject) { this.subject = subject; return this; } - public MimeMessageBuilder setBody(@Nonnull String body) { + public MimeMessageBuilder setBody(@NonNull String body) { this.body = body; return this; } @@ -156,7 +156,7 @@ public MimeMessageBuilder setRecipientFilter(AddressFilter recipientFilter) { return this; } - public MimeMessageBuilder addRecipients(@Nonnull String recipients) throws UnsupportedEncodingException { + public MimeMessageBuilder addRecipients(@NonNull String recipients) throws UnsupportedEncodingException { addRecipients(recipients, Message.RecipientType.TO); return this; } @@ -168,7 +168,7 @@ public MimeMessageBuilder addRecipients(@Nonnull String recipients) throws Unsup * @return the constructed message with the given recipients * @throws UnsupportedEncodingException in case of encoding problems */ - public MimeMessageBuilder addRecipients(@Nonnull String recipients, @Nonnull Message.RecipientType recipientType) throws UnsupportedEncodingException { + public MimeMessageBuilder addRecipients(@NonNull String recipients, @NonNull Message.RecipientType recipientType) throws UnsupportedEncodingException { StringTokenizer tokens = new StringTokenizer(recipients, " \t\n\r\f,"); while (tokens.hasMoreTokens()) { String addressToken = tokens.nextToken(); @@ -239,7 +239,7 @@ private static Address[] toAddressArray(Collection c) { return addresses; } - public static void setInReplyTo(@Nonnull MimeMessage msg, @Nonnull String inReplyTo) throws MessagingException { + public static void setInReplyTo(@NonNull MimeMessage msg, @NonNull String inReplyTo) throws MessagingException { msg.setHeader("In-Reply-To", inReplyTo); msg.setHeader("References", inReplyTo); }