Skip to content

Commit d90c0eb

Browse files
author
Greg Meyer
authored
Merge pull request #5 from DirectProjectJavaRI/develop
Releasing 8.0.0
2 parents 509cb6a + 86f68a4 commit d90c0eb

18 files changed

Lines changed: 320 additions & 309 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
hs_err_pid*
2424
/.classpath
2525
/.project
26+
/target/

pom.xml

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nhind</groupId>
55
<artifactId>direct-smtp-mq-gateway</artifactId>
6-
<version>6.0</version>
6+
<version>8.0.0</version>
77
<packaging>jar</packaging>
88
<name>DirectProject Java RI Lightweight SMTP Server Gateway Standalone Spring Boot Micro-service Application</name>
99
<description>DirectProject Java RI Lightweight SMTP Server Gateway Standalone Spring Boot Micro-service Application</description>
@@ -13,13 +13,14 @@
1313
<connection>scm:git:https://github.com/DirectProject/nhin-d.git</connection>
1414
</scm>
1515
<prerequisites>
16-
<maven>3.0.0</maven>
16+
<maven>3.5.0</maven>
1717
</prerequisites>
18-
<parent>
18+
<parent>
1919
<groupId>org.springframework.boot</groupId>
2020
<artifactId>spring-boot-starter-parent</artifactId>
21-
<version>2.1.9.RELEASE</version>
22-
</parent>
21+
<version>2.5.2</version>
22+
<relativePath />
23+
</parent>
2324
<developers>
2425
<developer>
2526
<name>Greg Meyer</name>
@@ -30,7 +31,6 @@
3031
</roles>
3132
</developer>
3233
</developers>
33-
3434
<licenses>
3535
<license>
3636
<name>New BSD License</name>
@@ -39,27 +39,29 @@
3939
</licenses>
4040
<properties>
4141
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42+
<subethasmtp.version>3.1.7</subethasmtp.version>
43+
<commons-net.version>3.8.0</commons-net.version>
4244
</properties>
4345
<dependencyManagement>
4446
<dependencies>
4547
<dependency>
4648
<groupId>org.springframework.boot</groupId>
4749
<artifactId>spring-boot-dependencies</artifactId>
48-
<version>2.1.9.RELEASE</version>
50+
<version>2.5.2</version>
4951
<type>pom</type>
5052
<scope>import</scope>
5153
</dependency>
5254
<dependency>
5355
<groupId>io.pivotal.spring.cloud</groupId>
5456
<artifactId>spring-cloud-services-dependencies</artifactId>
55-
<version>2.1.4.RELEASE</version>
57+
<version>3.3.0</version>
5658
<type>pom</type>
5759
<scope>import</scope>
58-
</dependency>
60+
</dependency>
5961
<dependency>
6062
<groupId>org.springframework.cloud</groupId>
6163
<artifactId>spring-cloud-starter-parent</artifactId>
62-
<version>Greenwich.SR3</version>
64+
<version>2020.0.3</version>
6365
<type>pom</type>
6466
<scope>import</scope>
6567
</dependency>
@@ -105,21 +107,37 @@
105107
<dependency>
106108
<groupId>org.springframework.cloud</groupId>
107109
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
108-
</dependency>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.springframework.cloud</groupId>
113+
<artifactId>spring-cloud-starter-bootstrap</artifactId>
114+
</dependency>
109115
<dependency>
110116
<groupId>org.springframework.boot</groupId>
111117
<artifactId>spring-boot-configuration-processor</artifactId>
112118
<optional>true</optional>
113119
</dependency>
120+
<!-- Needed for unit testing function spring cloud streams -->
121+
<dependency>
122+
<groupId>org.springframework.cloud</groupId>
123+
<artifactId>spring-cloud-stream</artifactId>
124+
<type>test-jar</type>
125+
<scope>test</scope>
126+
<classifier>test-binder</classifier>
127+
</dependency>
128+
<dependency>
129+
<groupId>org.projectlombok</groupId>
130+
<artifactId>lombok</artifactId>
131+
</dependency>
114132
<dependency>
115133
<groupId>org.nhind</groupId>
116134
<artifactId>direct-common</artifactId>
117-
<version>6.0.1</version>
135+
<version>8.0.0</version>
118136
</dependency>
119137
<dependency>
120138
<groupId>org.subethamail</groupId>
121139
<artifactId>subethasmtp</artifactId>
122-
<version>3.1.7</version>
140+
<version>${subethasmtp.version}</version>
123141
<exclusions>
124142
<exclusion>
125143
<artifactId>mail</artifactId>
@@ -130,13 +148,8 @@
130148
<dependency>
131149
<groupId>commons-net</groupId>
132150
<artifactId>commons-net</artifactId>
133-
<version>3.6</version>
151+
<version>${commons-net.version}</version>
134152
<scope>compile</scope>
135-
</dependency>
136-
<dependency>
137-
<groupId>org.springframework.cloud</groupId>
138-
<artifactId>spring-cloud-stream-test-support</artifactId>
139-
<scope>test</scope>
140153
</dependency>
141154
<dependency>
142155
<groupId>org.springframework.boot</groupId>
@@ -186,27 +199,21 @@
186199
</jvmArguments>
187200
</configuration>
188201
</plugin>
189-
<!-- for releases only
190-
<plugin>
191-
<groupId>org.apache.maven.plugins</groupId>
192-
<artifactId>maven-javadoc-plugin</artifactId>
193-
<version>2.9.1</version>
194-
<configuration>
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-javadoc-plugin</artifactId>
205+
<configuration>
206+
<additionalJOption>-Xdoclint:none</additionalJOption>
195207
<charset>UTF-8</charset>
196208
<docencoding>UTF-8</docencoding>
209+
<docfilessubdirs>true</docfilessubdirs>
210+
<detectJavaApiLink>true</detectJavaApiLink>
211+
<detectLinks>true</detectLinks>
197212
<source>1.8</source>
198-
<show>public</show>
199-
</configuration>
200-
<executions>
201-
<execution>
202-
<phase>package</phase>
203-
<id>attach-javadocs</id>
204-
<goals>
205-
<goal>jar</goal>
206-
</goals>
207-
</execution>
208-
</executions>
209-
</plugin>
213+
<show>public</show>
214+
</configuration>
215+
</plugin>
216+
<!-- for releases only
210217
<plugin>
211218
<groupId>org.apache.maven.plugins</groupId>
212219
<artifactId>maven-gpg-plugin</artifactId>
@@ -219,6 +226,7 @@
219226
</goals>
220227
</execution>
221228
</executions>
229+
<version>3.0.1</version>
222230
</plugin>
223231
-->
224232
</plugins>
@@ -228,22 +236,21 @@
228236
<plugin>
229237
<groupId>org.apache.maven.plugins</groupId>
230238
<artifactId>maven-project-info-reports-plugin</artifactId>
231-
<version>2.9</version>
232239
</plugin>
233-
<plugin>
234-
<groupId>org.apache.maven.plugins</groupId>
235-
<artifactId>maven-javadoc-plugin</artifactId>
236-
<version>3.0.1</version>
237-
<configuration>
240+
<plugin>
241+
<groupId>org.apache.maven.plugins</groupId>
242+
<artifactId>maven-javadoc-plugin</artifactId>
243+
<configuration>
244+
<additionalJOption>-Xdoclint:none</additionalJOption>
238245
<charset>UTF-8</charset>
239246
<docencoding>UTF-8</docencoding>
240247
<docfilessubdirs>true</docfilessubdirs>
241248
<detectJavaApiLink>true</detectJavaApiLink>
242249
<detectLinks>true</detectLinks>
243250
<source>1.8</source>
244-
<show>protected</show>
245-
</configuration>
246-
</plugin>
251+
<show>public</show>
252+
</configuration>
253+
</plugin>
247254
<plugin>
248255
<groupId>org.apache.maven.plugins</groupId>
249256
<artifactId>maven-pmd-plugin</artifactId>
@@ -258,11 +265,11 @@
258265
<plugin>
259266
<groupId>org.apache.maven.plugins</groupId>
260267
<artifactId>maven-jxr-plugin</artifactId>
268+
<version>3.1.1</version>
261269
</plugin>
262270
<plugin>
263271
<groupId>org.codehaus.mojo</groupId>
264272
<artifactId>findbugs-maven-plugin</artifactId>
265-
<version>1.2</version>
266273
<configuration>
267274
<effort>Max</effort>
268275
</configuration>

src/main/java/org/nhindirect/smtpmq/gateway/boot/SmtpGatewayApplication.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.nhindirect.smtpmq.gateway.boot;
22

3-
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
43
import org.springframework.beans.factory.annotation.Autowired;
54
import org.springframework.boot.CommandLineRunner;
65
import org.springframework.boot.WebApplicationType;
@@ -15,9 +14,6 @@
1514
@EnableScheduling
1615
public class SmtpGatewayApplication implements CommandLineRunner
1716
{
18-
@Autowired
19-
protected ConnectionFactory connectionFactory;
20-
2117
@Autowired
2218
protected SMTPServer smtpServer;
2319

src/main/java/org/nhindirect/smtpmq/gateway/server/SMTPMessageHandler.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
import org.apache.commons.io.input.CountingInputStream;
1818
import org.nhindirect.common.mail.SMTPMailMessage;
1919
import org.nhindirect.smtpmq.gateway.streams.SmtpGatewayMessageSource;
20-
import org.slf4j.Logger;
21-
import org.slf4j.LoggerFactory;
2220
import org.springframework.util.StringUtils;
2321
import org.subethamail.smtp.MessageHandler;
2422
import org.subethamail.smtp.RejectException;
2523
import org.subethamail.smtp.TooMuchDataException;
2624

25+
import lombok.extern.slf4j.Slf4j;
26+
27+
@Slf4j
2728
public class SMTPMessageHandler implements MessageHandler
2829
{
29-
private static final Logger LOGGER = LoggerFactory.getLogger(SMTPMessageHandler.class);
30-
3130
protected SmtpGatewayMessageSource messageSource;
3231
protected GetMessageHeaderStream getMessageHeaderStream;
3332
protected SizeLimitedStreamCreator sizeLimitedStreamCreator;
@@ -54,15 +53,15 @@ public void from(String from) throws RejectException
5453
{
5554
try
5655
{
57-
if (!StringUtils.isEmpty(from))
56+
if (StringUtils.hasText(from))
5857
{
5958
this.from = new InternetAddress(from);
6059

6160
// handle "<>" scenario
62-
if (StringUtils.isEmpty(this.from.getAddress()))
61+
if (!StringUtils.hasText(this.from.getAddress()))
6362
{
6463
this.from = null;
65-
LOGGER.info("blank address... mailFrom will be null");
64+
log.info("blank address... mailFrom will be null");
6665
}
6766

6867
}
@@ -86,7 +85,7 @@ public void recipient(String recipient) throws RejectException
8685
catch (AddressException e)
8786
{
8887
String errorMessage = "error parsing recipient address " + recipient;
89-
LOGGER.error(errorMessage, e);
88+
log.error(errorMessage, e);
9089
throw new RejectException(errorMessage);
9190
}
9291

@@ -131,7 +130,7 @@ protected void updateMessageID() throws MessagingException
131130
* 552 - Requested mail action aborted: exceeded storage allocation
132131
*/
133132
errorMessage += ": " + e.getCause().getMessage();
134-
LOGGER.error(errorMessage, e);
133+
log.error(errorMessage, e);
135134
throw new RejectException(552, errorMessage);
136135
}
137136
else
@@ -140,7 +139,7 @@ protected void updateMessageID() throws MessagingException
140139
* RFC821:
141140
* Service not available, closing transmission channel [This may be a reply to any command if the service knows it must shut down]
142141
*/
143-
LOGGER.error(errorMessage, e);
142+
log.error(errorMessage, e);
144143
throw new RejectException(421, errorMessage);
145144
}
146145
}
@@ -152,15 +151,15 @@ protected void updateMessageID() throws MessagingException
152151
messageId = mimeMessage.getMessageID();
153152
messageSource.forwardSMTPMessage(mailMessage);
154153

155-
LOGGER.info("successfully sent message with message id {} ({} bytes)", messageId, countingInputStream.getByteCount());
154+
log.info("successfully sent message with message id {} ({} bytes)", messageId, countingInputStream.getByteCount());
156155
}
157156
catch (Throwable e)
158157
{
159158
/*
160159
* RFC821:
161160
* Transaction failed
162161
*/
163-
LOGGER.error("error sending message with message id " + messageId, e);
162+
log.error("error sending message with message id " + messageId, e);
164163
throw new RejectException(554, "Error sending message: " + e.getMessage());
165164
}
166165
}

src/main/java/org/nhindirect/smtpmq/gateway/springconfig/SMTPServerBeanConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class SMTPServerBeanConfig
4242
private int maxMessageSize;
4343

4444

45-
@Value("#{'${direct.smtpmqgateway.clientwhitelist.cidr:}'.split(',')}")
45+
@Value("${direct.smtpmqgateway.clientwhitelist.cidr:}")
4646
private List<String> clientWhitelistCidrs;
4747

4848
@Autowired
@@ -65,7 +65,7 @@ public MessageHandler create(MessageContext ctx)
6565
protected ServerSocket createServerSocket() throws IOException
6666
{
6767
if (clientWhitelistCidrs.isEmpty() ||
68-
(clientWhitelistCidrs.size() == 1 && StringUtils.isEmpty(clientWhitelistCidrs.get(0))))
68+
(clientWhitelistCidrs.size() == 1 && !StringUtils.hasText(clientWhitelistCidrs.get(0))))
6969
return super.createServerSocket();
7070

7171
InetSocketAddress isa;

src/main/java/org/nhindirect/smtpmq/gateway/streams/SmtpGatewayMessageOutput.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)