Skip to content

Commit 950423f

Browse files
committed
#335: fixed precondition bug where nonNull also checked for nonEmpty (which is a valid state for email address criteria)
1 parent a91d9fd commit 950423f

File tree

14 files changed

+95
-70
lines changed

14 files changed

+95
-70
lines changed

modules/authenticated-socks-module/src/main/java/org/simplejavamail/internal/authenticatedsockssupport/AuthenticatingSocks5Bridge.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.net.InetSocketAddress;
1515
import java.net.Socket;
1616

17-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
17+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
1818

1919
/**
2020
* Please refer to {@link Socks5Bridge}.
@@ -28,8 +28,8 @@ public class AuthenticatingSocks5Bridge implements Socks5Bridge {
2828

2929
AuthenticatingSocks5Bridge(final ProxyConfig proxyConfig) {
3030
this.proxyConfig = proxyConfig;
31-
this.remoteProxyHost = assumeNonNull(proxyConfig.getRemoteProxyHost());
32-
this.remoteProxyPort = assumeNonNull(proxyConfig.getRemoteProxyPort());
31+
this.remoteProxyHost = verifyNonnullOrEmpty(proxyConfig.getRemoteProxyHost());
32+
this.remoteProxyPort = verifyNonnullOrEmpty(proxyConfig.getRemoteProxyPort());
3333
}
3434

3535
/**

modules/core-module/src/main/java/org/simplejavamail/api/mailer/config/TransportStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.Properties;
1010

1111
import static java.lang.String.format;
12-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
12+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
1313
import static org.simplejavamail.config.ConfigLoader.Property.OPPORTUNISTIC_TLS;
1414

1515
/**
@@ -72,7 +72,7 @@ public enum TransportStrategy {
7272
public Properties generateProperties() {
7373
final Properties props = super.generateProperties();
7474
props.put("mail.transport.protocol", "smtp");
75-
if (assumeNonNull(ConfigLoader.valueOrPropertyAsBoolean(opportunisticTLS, OPPORTUNISTIC_TLS, DEFAULT_OPPORTUNISTIC_TLS))) {
75+
if (verifyNonnullOrEmpty(ConfigLoader.valueOrPropertyAsBoolean(opportunisticTLS, OPPORTUNISTIC_TLS, DEFAULT_OPPORTUNISTIC_TLS))) {
7676
LOGGER.debug("Opportunistic TLS mode enabled for SMTP plain protocol.");
7777
props.put("mail.smtp.starttls.enable", "true");
7878
props.put("mail.smtp.starttls.required", "false");

modules/core-module/src/main/java/org/simplejavamail/internal/util/Preconditions.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,24 @@ private Preconditions() {
1212

1313
@NotNull
1414
public static <T> T checkNonEmptyArgument(@Nullable final T arg, @NotNull final String parameterName) {
15-
return verifyNonnull(arg, format("%s is required", parameterName));
15+
return verifyNonnullOrEmpty(arg, format("%s is required", parameterName));
1616
}
1717

1818
@NotNull
19-
public static <T> T assumeNonNull(@Nullable final T arg) {
20-
return verifyNonnull(arg, "argument was assumed nonNull, but was null");
19+
public static <T> T verifyNonnull(@Nullable final T arg) {
20+
if (arg == null) {
21+
throw new IllegalArgumentException("argument was assumed nonNull, but was null");
22+
}
23+
return arg;
24+
}
25+
26+
@NotNull
27+
public static <T> T verifyNonnullOrEmpty(@Nullable final T arg) {
28+
return verifyNonnullOrEmpty(arg, "argument was assumed nonNull and nonEmpty, but was null or empty");
2129
}
2230

2331
@NotNull
24-
private static <T> T verifyNonnull(@Nullable final T arg, @NotNull final String message) {
32+
private static <T> T verifyNonnullOrEmpty(@Nullable final T arg, @NotNull final String message) {
2533
if (MiscUtil.valueNullOrEmpty(arg)) {
2634
throw new IllegalArgumentException(message);
2735
}

modules/outlook-module/src/main/java/org/simplejavamail/internal/outlooksupport/converter/OutlookEmailConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import java.util.Map;
2626

2727
import static org.simplejavamail.internal.util.MiscUtil.extractCID;
28-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
28+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
2929
import static org.simplejavamail.internal.util.Preconditions.checkNonEmptyArgument;
3030
import static org.simplejavamail.internal.util.SimpleOptional.ofNullable;
3131
import static org.slf4j.LoggerFactory.getLogger;
@@ -95,7 +95,7 @@ private static EmailFromOutlookMessage buildEmailFromOutlookMessage(
9595

9696
for (final Map.Entry<String, OutlookFileAttachment> cid : outlookMessage.fetchCIDMap().entrySet()) {
9797
final String cidName = checkNonEmptyArgument(cid.getKey(), "cid.key");
98-
builder.withEmbeddedImage(assumeNonNull(extractCID(cidName)), cid.getValue().getData(), cid.getValue().getMimeTag());
98+
builder.withEmbeddedImage(verifyNonnullOrEmpty(extractCID(cidName)), cid.getValue().getData(), cid.getValue().getMimeTag());
9999
}
100100
for (final OutlookFileAttachment attachment : outlookMessage.fetchTrueAttachments()) {
101101
String attachmentName = ofNullable(attachment.getLongFilename()).orMaybe(attachment.getFilename());

modules/simple-java-mail/src/main/java/org/simplejavamail/converter/EmailConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import static org.simplejavamail.internal.modules.ModuleLoader.loadSmimeModule;
4848
import static org.simplejavamail.internal.util.MiscUtil.extractCID;
4949
import static org.simplejavamail.internal.util.MiscUtil.readInputStreamToString;
50-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
50+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
5151
import static org.simplejavamail.internal.util.Preconditions.checkNonEmptyArgument;
5252

5353
/**
@@ -675,7 +675,7 @@ private static EmailPopulatingBuilder buildEmailFromMimeMessage(@NotNull final E
675675
builder.withHTMLText(parsed.getHtmlContent());
676676

677677
if (parsed.getCalendarMethod() != null) {
678-
builder.withCalendarText(CalendarMethod.valueOf(parsed.getCalendarMethod()), assumeNonNull(parsed.getCalendarContent()));
678+
builder.withCalendarText(CalendarMethod.valueOf(parsed.getCalendarMethod()), verifyNonnullOrEmpty(parsed.getCalendarContent()));
679679
}
680680

681681
for (final Map.Entry<String, DataSource> cid : parsed.getCidMap().entrySet()) {

modules/simple-java-mail/src/main/java/org/simplejavamail/email/internal/EmailPopulatingBuilderImpl.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
import static org.simplejavamail.internal.util.MiscUtil.tryResolveImageFileDataSourceFromDisk;
9797
import static org.simplejavamail.internal.util.MiscUtil.tryResolveUrlDataSource;
9898
import static org.simplejavamail.internal.util.MiscUtil.valueNullOrEmpty;
99-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
99+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
100100
import static org.simplejavamail.internal.util.Preconditions.checkNonEmptyArgument;
101101

102102
/**
@@ -332,70 +332,70 @@ public class EmailPopulatingBuilderImpl implements InternalEmailPopulatingBuilde
332332

333333
if (applyDefaults) {
334334
if (hasProperty(DEFAULT_FROM_ADDRESS)) {
335-
from(getStringProperty(DEFAULT_FROM_NAME), assumeNonNull(getStringProperty(DEFAULT_FROM_ADDRESS)));
335+
from(getStringProperty(DEFAULT_FROM_NAME), verifyNonnullOrEmpty(getStringProperty(DEFAULT_FROM_ADDRESS)));
336336
}
337337
if (hasProperty(DEFAULT_REPLYTO_ADDRESS)) {
338-
withReplyTo(getStringProperty(DEFAULT_REPLYTO_NAME), assumeNonNull(getStringProperty(DEFAULT_REPLYTO_ADDRESS)));
338+
withReplyTo(getStringProperty(DEFAULT_REPLYTO_NAME), verifyNonnullOrEmpty(getStringProperty(DEFAULT_REPLYTO_ADDRESS)));
339339
}
340340
if (hasProperty(DEFAULT_BOUNCETO_ADDRESS)) {
341-
withBounceTo(getStringProperty(DEFAULT_BOUNCETO_NAME), assumeNonNull(getStringProperty(DEFAULT_BOUNCETO_ADDRESS)));
341+
withBounceTo(getStringProperty(DEFAULT_BOUNCETO_NAME), verifyNonnullOrEmpty(getStringProperty(DEFAULT_BOUNCETO_ADDRESS)));
342342
}
343343
if (hasProperty(DEFAULT_TO_ADDRESS)) {
344344
if (hasProperty(DEFAULT_TO_NAME)) {
345345
to(getStringProperty(DEFAULT_TO_NAME), getStringProperty(DEFAULT_TO_ADDRESS));
346346
} else {
347-
to(assumeNonNull(getStringProperty(DEFAULT_TO_ADDRESS)));
347+
to(verifyNonnullOrEmpty(getStringProperty(DEFAULT_TO_ADDRESS)));
348348
}
349349
}
350350
if (hasProperty(DEFAULT_CC_ADDRESS)) {
351351
if (hasProperty(DEFAULT_CC_NAME)) {
352352
cc(getStringProperty(DEFAULT_CC_NAME), getStringProperty(DEFAULT_CC_ADDRESS));
353353
} else {
354-
cc(assumeNonNull(getStringProperty(DEFAULT_CC_ADDRESS)));
354+
cc(verifyNonnullOrEmpty(getStringProperty(DEFAULT_CC_ADDRESS)));
355355
}
356356
}
357357
if (hasProperty(DEFAULT_BCC_ADDRESS)) {
358358
if (hasProperty(DEFAULT_BCC_NAME)) {
359359
bcc(getStringProperty(DEFAULT_BCC_NAME), getStringProperty(DEFAULT_BCC_ADDRESS));
360360
} else {
361-
bcc(assumeNonNull(getStringProperty(DEFAULT_BCC_ADDRESS)));
361+
bcc(verifyNonnullOrEmpty(getStringProperty(DEFAULT_BCC_ADDRESS)));
362362
}
363363
}
364364
if (hasProperty(DEFAULT_SUBJECT)) {
365365
withSubject((String) getProperty(DEFAULT_SUBJECT));
366366
}
367367
if (hasProperty(SMIME_ENCRYPTION_CERTIFICATE)) {
368-
encryptWithSmime(assumeNonNull(getStringProperty(SMIME_ENCRYPTION_CERTIFICATE)));
368+
encryptWithSmime(verifyNonnullOrEmpty(getStringProperty(SMIME_ENCRYPTION_CERTIFICATE)));
369369
}
370370
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_DIR)) {
371-
withEmbeddedImageAutoResolutionForFiles(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_DIR)));
371+
withEmbeddedImageAutoResolutionForFiles(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_DIR)));
372372
}
373373
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_CLASSPATH)) {
374-
withEmbeddedImageAutoResolutionForClassPathResources(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_CLASSPATH)));
374+
withEmbeddedImageAutoResolutionForClassPathResources(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_CLASSPATH)));
375375
}
376376
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_URL)) {
377-
withEmbeddedImageAutoResolutionForURLs(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_URL)));
377+
withEmbeddedImageAutoResolutionForURLs(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_ENABLE_URL)));
378378
}
379379
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_DIR)) {
380-
withEmbeddedImageBaseDir(assumeNonNull(getStringProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_DIR)));
380+
withEmbeddedImageBaseDir(verifyNonnullOrEmpty(getStringProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_DIR)));
381381
}
382382
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_CLASSPATH)) {
383-
withEmbeddedImageBaseClassPath(assumeNonNull(getStringProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_CLASSPATH)));
383+
withEmbeddedImageBaseClassPath(verifyNonnullOrEmpty(getStringProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_CLASSPATH)));
384384
}
385385
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_URL)) {
386-
withEmbeddedImageBaseUrl(assumeNonNull(getStringProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_URL)));
386+
withEmbeddedImageBaseUrl(verifyNonnullOrEmpty(getStringProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_BASE_URL)));
387387
}
388388
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_DIR)) {
389-
allowingEmbeddedImageOutsideBaseDir(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_DIR)));
389+
allowingEmbeddedImageOutsideBaseDir(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_DIR)));
390390
}
391391
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_URL)) {
392-
allowingEmbeddedImageOutsideBaseClassPath(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_URL)));
392+
allowingEmbeddedImageOutsideBaseClassPath(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_URL)));
393393
}
394394
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_CLASSPATH)) {
395-
allowingEmbeddedImageOutsideBaseUrl(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_CLASSPATH)));
395+
allowingEmbeddedImageOutsideBaseUrl(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_OUTSIDE_BASE_CLASSPATH)));
396396
}
397397
if (hasProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_MUSTBESUCCESFUL)) {
398-
embeddedImageAutoResolutionMustBeSuccesful(assumeNonNull(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_MUSTBESUCCESFUL)));
398+
embeddedImageAutoResolutionMustBeSuccesful(verifyNonnullOrEmpty(getBooleanProperty(EMBEDDEDIMAGES_DYNAMICRESOLUTION_MUSTBESUCCESFUL)));
399399
}
400400
}
401401
}

modules/simple-java-mail/src/main/java/org/simplejavamail/email/internal/EmailStartingBuilderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import static java.lang.String.format;
1515
import static org.simplejavamail.internal.util.MiscUtil.defaultTo;
16-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
16+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
1717

1818
/**
1919
* @see EmailStartingBuilder
@@ -212,7 +212,7 @@ public EmailPopulatingBuilder copying(@NotNull final Email email) {
212212
builder.fixingSentDate(email.getSentDate());
213213
}
214214
if (email.getDkimPrivateKeyData() != null) {
215-
builder.signWithDomainKey(email.getDkimPrivateKeyData(), assumeNonNull(email.getDkimSigningDomain()), assumeNonNull(email.getDkimSelector()));
215+
builder.signWithDomainKey(email.getDkimPrivateKeyData(), verifyNonnullOrEmpty(email.getDkimSigningDomain()), verifyNonnullOrEmpty(email.getDkimSelector()));
216216
}
217217
if (email.getDispositionNotificationTo() != null) {
218218
builder.withDispositionNotificationTo(email.getDispositionNotificationTo());

modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/MailerGenericBuilderImpl.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
import static org.simplejavamail.internal.util.MiscUtil.checkArgumentNotEmpty;
4747
import static org.simplejavamail.internal.util.MiscUtil.readInputStreamToBytes;
4848
import static org.simplejavamail.internal.util.MiscUtil.valueNullOrEmpty;
49-
import static org.simplejavamail.internal.util.Preconditions.assumeNonNull;
5049
import static org.simplejavamail.internal.util.Preconditions.checkNonEmptyArgument;
50+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnull;
51+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnullOrEmpty;
5152
import static org.simplejavamail.mailer.internal.MailerException.ERROR_READING_FROM_FILE;
5253
import static org.simplejavamail.mailer.internal.MailerException.ERROR_READING_SMIME_FROM_INPUTSTREAM;
5354

@@ -214,23 +215,23 @@ abstract class MailerGenericBuilderImpl<T extends MailerGenericBuilderImpl<?>> i
214215
this.proxyPassword = getStringProperty(PROXY_PASSWORD);
215216
}
216217
this.clusterKey = hasProperty(DEFAULT_CONNECTIONPOOL_CLUSTER_KEY)
217-
? UUID.fromString(assumeNonNull(getStringProperty(DEFAULT_CONNECTIONPOOL_CLUSTER_KEY)))
218+
? UUID.fromString(verifyNonnullOrEmpty(getStringProperty(DEFAULT_CONNECTIONPOOL_CLUSTER_KEY)))
218219
: UUID.randomUUID(); // <-- this makes sure it won't form a cluster with another mailer
219220

220-
this.proxyPort = assumeNonNull(valueOrPropertyAsInteger(null, Property.PROXY_PORT, DEFAULT_PROXY_PORT));
221-
this.proxyBridgePort = assumeNonNull(valueOrPropertyAsInteger(null, Property.PROXY_SOCKS5BRIDGE_PORT, DEFAULT_PROXY_BRIDGE_PORT));
222-
this.debugLogging = assumeNonNull(valueOrPropertyAsBoolean(null, Property.JAVAXMAIL_DEBUG, DEFAULT_JAVAXMAIL_DEBUG));
223-
this.sessionTimeout = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_SESSION_TIMEOUT_MILLIS, DEFAULT_SESSION_TIMEOUT_MILLIS));
224-
this.trustAllSSLHost = assumeNonNull(valueOrPropertyAsBoolean(null, Property.DEFAULT_TRUST_ALL_HOSTS, DEFAULT_TRUST_ALL_HOSTS));
225-
this.verifyingServerIdentity = assumeNonNull(valueOrPropertyAsBoolean(null, Property.DEFAULT_VERIFY_SERVER_IDENTITY, DEFAULT_VERIFY_SERVER_IDENTITY));
226-
this.threadPoolSize = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_POOL_SIZE, DEFAULT_POOL_SIZE));
227-
this.threadPoolKeepAliveTime = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_POOL_KEEP_ALIVE_TIME, DEFAULT_POOL_KEEP_ALIVE_TIME));
228-
this.connectionPoolCoreSize = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_CORE_SIZE, DEFAULT_CONNECTIONPOOL_CORE_SIZE));
229-
this.connectionPoolMaxSize = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_MAX_SIZE, DEFAULT_CONNECTIONPOOL_MAX_SIZE));
230-
this.connectionPoolClaimTimeoutMillis = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_CLAIMTIMEOUT_MILLIS, DEFAULT_CONNECTIONPOOL_CLAIMTIMEOUT_MILLIS));
231-
this.connectionPoolExpireAfterMillis = assumeNonNull(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_EXPIREAFTER_MILLIS, DEFAULT_CONNECTIONPOOL_EXPIREAFTER_MILLIS));
232-
this.connectionPoolLoadBalancingStrategy = assumeNonNull(valueOrProperty(null, Property.DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY, LoadBalancingStrategy.valueOf(DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY)));
233-
this.transportModeLoggingOnly = assumeNonNull(valueOrPropertyAsBoolean(null, Property.TRANSPORT_MODE_LOGGING_ONLY, DEFAULT_TRANSPORT_MODE_LOGGING_ONLY));
221+
this.proxyPort = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.PROXY_PORT, DEFAULT_PROXY_PORT));
222+
this.proxyBridgePort = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.PROXY_SOCKS5BRIDGE_PORT, DEFAULT_PROXY_BRIDGE_PORT));
223+
this.debugLogging = verifyNonnullOrEmpty(valueOrPropertyAsBoolean(null, Property.JAVAXMAIL_DEBUG, DEFAULT_JAVAXMAIL_DEBUG));
224+
this.sessionTimeout = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_SESSION_TIMEOUT_MILLIS, DEFAULT_SESSION_TIMEOUT_MILLIS));
225+
this.trustAllSSLHost = verifyNonnullOrEmpty(valueOrPropertyAsBoolean(null, Property.DEFAULT_TRUST_ALL_HOSTS, DEFAULT_TRUST_ALL_HOSTS));
226+
this.verifyingServerIdentity = verifyNonnullOrEmpty(valueOrPropertyAsBoolean(null, Property.DEFAULT_VERIFY_SERVER_IDENTITY, DEFAULT_VERIFY_SERVER_IDENTITY));
227+
this.threadPoolSize = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_POOL_SIZE, DEFAULT_POOL_SIZE));
228+
this.threadPoolKeepAliveTime = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_POOL_KEEP_ALIVE_TIME, DEFAULT_POOL_KEEP_ALIVE_TIME));
229+
this.connectionPoolCoreSize = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_CORE_SIZE, DEFAULT_CONNECTIONPOOL_CORE_SIZE));
230+
this.connectionPoolMaxSize = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_MAX_SIZE, DEFAULT_CONNECTIONPOOL_MAX_SIZE));
231+
this.connectionPoolClaimTimeoutMillis = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_CLAIMTIMEOUT_MILLIS, DEFAULT_CONNECTIONPOOL_CLAIMTIMEOUT_MILLIS));
232+
this.connectionPoolExpireAfterMillis = verifyNonnullOrEmpty(valueOrPropertyAsInteger(null, Property.DEFAULT_CONNECTIONPOOL_EXPIREAFTER_MILLIS, DEFAULT_CONNECTIONPOOL_EXPIREAFTER_MILLIS));
233+
this.connectionPoolLoadBalancingStrategy = verifyNonnullOrEmpty(valueOrProperty(null, Property.DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY, LoadBalancingStrategy.valueOf(DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY)));
234+
this.transportModeLoggingOnly = verifyNonnullOrEmpty(valueOrPropertyAsBoolean(null, Property.TRANSPORT_MODE_LOGGING_ONLY, DEFAULT_TRANSPORT_MODE_LOGGING_ONLY));
234235

235236
final String trustedHosts = valueOrPropertyAsString(null, Property.DEFAULT_TRUSTED_HOSTS, null);
236237
if (trustedHosts != null) {
@@ -241,7 +242,7 @@ abstract class MailerGenericBuilderImpl<T extends MailerGenericBuilderImpl<?>> i
241242

242243
if (hasProperty(SMIME_SIGNING_KEYSTORE)) {
243244
signByDefaultWithSmime(Pkcs12Config.builder()
244-
.pkcs12Store(assumeNonNull(getStringProperty(SMIME_SIGNING_KEYSTORE)))
245+
.pkcs12Store(verifyNonnullOrEmpty(getStringProperty(SMIME_SIGNING_KEYSTORE)))
245246
.storePassword(checkNonEmptyArgument(getStringProperty(SMIME_SIGNING_KEYSTORE_PASSWORD), "Keystore password property"))
246247
.keyAlias(checkNonEmptyArgument(getStringProperty(SMIME_SIGNING_KEY_ALIAS), "Key alias property"))
247248
.keyPassword(checkNonEmptyArgument(getStringProperty(SMIME_SIGNING_KEY_PASSWORD), "Key password property"))
@@ -277,7 +278,7 @@ private void validateProxy() {
277278
* For internal use.
278279
*/
279280
EmailGovernance buildEmailGovernance() {
280-
return new EmailGovernanceImpl(assumeNonNull(getEmailAddressCriteria()), getPkcs12ConfigForSmimeSigning());
281+
return new EmailGovernanceImpl(verifyNonnull(getEmailAddressCriteria()), getPkcs12ConfigForSmimeSigning());
281282
}
282283

283284
/**

0 commit comments

Comments
 (0)