diff options
Diffstat (limited to 'server/sonar-server-common')
4 files changed, 15 insertions, 15 deletions
diff --git a/server/sonar-server-common/build.gradle b/server/sonar-server-common/build.gradle index 32d17033858..737bef78032 100644 --- a/server/sonar-server-common/build.gradle +++ b/server/sonar-server-common/build.gradle @@ -15,7 +15,7 @@ dependencies { api 'com.github.scribejava:scribejava-core' api 'com.google.guava:guava' api 'com.squareup.okhttp3:okhttp' - api 'org.apache.commons:commons-email' + api 'org.apache.commons:commons-email2-jakarta' api 'org.apache.commons:commons-lang3' api 'org.bouncycastle:bcprov-jdk18on' api 'org.elasticsearch.client:elasticsearch-rest-high-level-client' diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java b/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java index 047590493b0..27fceb8b664 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java @@ -23,10 +23,10 @@ import java.net.MalformedURLException; import java.time.Duration; import java.util.Properties; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.mail.Email; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.MultiPartEmail; +import org.apache.commons.mail2.core.EmailException; +import org.apache.commons.mail2.jakarta.Email; +import org.apache.commons.mail2.jakarta.HtmlEmail; +import org.apache.commons.mail2.jakarta.MultiPartEmail; import org.sonar.api.platform.Server; import org.sonar.server.oauth.OAuthMicrosoftRestClient; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java index 0fc971bd8f0..5144721d60d 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java @@ -28,10 +28,10 @@ import java.util.Set; import java.util.regex.Pattern; import javax.annotation.CheckForNull; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.mail.Email; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.SimpleEmail; +import org.apache.commons.mail2.jakarta.Email; +import org.apache.commons.mail2.core.EmailException; +import org.apache.commons.mail2.jakarta.HtmlEmail; +import org.apache.commons.mail2.jakarta.SimpleEmail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.notifications.Notification; @@ -66,8 +66,8 @@ public class EmailNotificationChannel extends NotificationChannel { private static final Logger LOG = LoggerFactory.getLogger(EmailNotificationChannel.class); /** - * @see org.apache.commons.mail.Email#setSocketConnectionTimeout(Duration) - * @see org.apache.commons.mail.Email#setSocketTimeout(Duration) + * @see org.apache.commons.mail2.jakarta.Email#setSocketConnectionTimeout(Duration) + * @see org.apache.commons.mail2.jakarta.Email#setSocketTimeout(Duration) */ private static final Duration SOCKET_TIMEOUT = Duration.of(30, SECONDS); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java index e8c549d2667..04bdc027776 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/email/EmailSenderTest.java @@ -21,8 +21,8 @@ package org.sonar.server.email; import java.util.Properties; import java.util.Set; -import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.MultiPartEmail; +import org.apache.commons.mail2.jakarta.HtmlEmail; +import org.apache.commons.mail2.jakarta.MultiPartEmail; import org.junit.Test; import org.sonar.api.platform.Server; import org.sonar.server.oauth.OAuthMicrosoftRestClient; @@ -41,7 +41,8 @@ public class EmailSenderTest { private final Server server = mock(); private final OAuthMicrosoftRestClient oAuthMicrosoftRestClient = mock(); private final EmailSender<BasicEmail> sender = new EmailSender<>(emailSmtpConfiguration, server, oAuthMicrosoftRestClient) { - @Override protected void addReportContent(HtmlEmail email, BasicEmail report) { + @Override + protected void addReportContent(HtmlEmail email, BasicEmail report) { email.setSubject("Email Subject"); } }; @@ -72,7 +73,6 @@ public class EmailSenderTest { assertThat(email.isStartTLSRequired()).isFalse(); } - @Test public void support_empty_body() throws Exception { BasicEmail basicEmail = new BasicEmail(Set.of("noreply@nowhere")); |