Skip to content

Commit 5eacf61

Browse files
authored
Upgrade to Angus Mail 2.0.3 (#929)
1 parent 10e46c4 commit 5eacf61

3 files changed

Lines changed: 13 additions & 20 deletions

File tree

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ npmWorkDirectory=.node
8888
# gradle.properties file to declare these version numbers. Naming
8989
# convention is <library name>Version camel-cased, i.e. "jacksonVersion".
9090

91-
activationApiVersion=2.1.3
91+
angusActivationVersion=2.0.2
92+
angusMailVersion=2.0.3
9293

9394
annotationsVersion=15.0
9495

@@ -200,7 +201,6 @@ jamaVersion=1.0.3
200201

201202
javassistVersion=3.20.0-GA
202203

203-
javaMailVersion=2.0.1
204204
javaxAnnotationVersion=1.3.2
205205

206206
# cloud, pipeline, query, and tests (sardine) use the old JAXB API and runtime versions

server/embedded/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ dependencies {
7777
}
7878

7979
runtimeOnly "org.apache.tomcat.embed:tomcat-embed-jasper:${apacheTomcatVersion}"
80-
runtimeOnly group: "com.sun.mail", name: "jakarta.mail", version: "${javaMailVersion}"
8180
runtimeOnly group: "org.apache.tomcat", name: "tomcat-dbcp", version: "${apacheTomcatVersion}"
82-
runtimeOnly "org.postgresql:postgresql:${postgresqlDriverVersion}"
8381
runtimeOnly "org.apache.logging.log4j:log4j-slf4j2-impl:${log4j2Version}"
8482
implementation "commons-io:commons-io:${commonsIoVersion}"
8583
implementation "org.apache.logging.log4j:log4j-core:${log4j2Version}"

server/embedded/src/org/labkey/embedded/LabKeyTomcatServletWebServerFactory.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ protected TomcatWebServer getTomcatWebServer(Tomcat tomcat)
144144
addExtraContextResources(contextProperties, context);
145145

146146
// Add the SMTP config
147-
context.getNamingResources().addResource(getMailResource());
147+
addSmtpProperties(context);
148148

149149
// Add the encryption key(s)
150150
context.addParameter("EncryptionKey", contextProperties.getEncryptionKey());
@@ -373,39 +373,34 @@ private String getPropValue(Map<Integer, String> propValues, Integer resourceKey
373373
return val != null && !val.isBlank() ? val.trim() : defaultValue;
374374
}
375375

376-
private ContextResource getMailResource()
376+
private void addSmtpProperties(StandardContext context)
377377
{
378378
// Get session/mail properties
379379
LabKeyServer.MailProperties mailProps = _server.smtpSource();
380-
ContextResource mailResource = new ContextResource();
381-
mailResource.setName("mail/Session");
382-
mailResource.setAuth("Container");
383-
mailResource.setType("jakarta.mail.Session");
384-
mailResource.setProperty("mail.smtp.host", mailProps.getSmtpHost());
385-
mailResource.setProperty("mail.smtp.user", mailProps.getSmtpUser());
386-
mailResource.setProperty("mail.smtp.port", mailProps.getSmtpPort());
380+
381+
context.addParameter("mail.smtp.host", mailProps.getSmtpHost());
382+
context.addParameter("mail.smtp.user", mailProps.getSmtpUser());
383+
context.addParameter("mail.smtp.port", mailProps.getSmtpPort());
387384

388385
if (mailProps.getSmtpFrom() != null)
389386
{
390-
mailResource.setProperty("mail.smtp.from", mailProps.getSmtpFrom());
387+
context.addParameter("mail.smtp.from", mailProps.getSmtpFrom());
391388
}
392389
if (mailProps.getSmtpPassword() != null)
393390
{
394-
mailResource.setProperty("mail.smtp.password", mailProps.getSmtpPassword());
391+
context.addParameter("mail.smtp.password", mailProps.getSmtpPassword());
395392
}
396393
if (mailProps.getSmtpStartTlsEnable() != null)
397394
{
398-
mailResource.setProperty("mail.smtp.starttls.enable", mailProps.getSmtpStartTlsEnable());
395+
context.addParameter("mail.smtp.starttls.enable", mailProps.getSmtpStartTlsEnable());
399396
}
400397
if (mailProps.getSmtpSocketFactoryClass() != null)
401398
{
402-
mailResource.setProperty("mail.smtp.socketFactory.class", mailProps.getSmtpSocketFactoryClass());
399+
context.addParameter("mail.smtp.socketFactory.class", mailProps.getSmtpSocketFactoryClass());
403400
}
404401
if (mailProps.getSmtpAuth() != null)
405402
{
406-
mailResource.setProperty("mail.smtp.auth", mailProps.getSmtpAuth());
403+
context.addParameter("mail.smtp.auth", mailProps.getSmtpAuth());
407404
}
408-
409-
return mailResource;
410405
}
411406
}

0 commit comments

Comments
 (0)