Skip to content

Commit

Permalink
Fix default SMTP port value in builder
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgaldi committed Aug 22, 2024
1 parent a468a3d commit f73490c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class ModelConfig implements OAuthConfig, KeyStoreConfig {
private static final Logger LOG = Logger.getLogger(ModelConfig.class);

public static final String WSF_LOCAL = "local";
private static final int DEFAULT_SMTP_PORT = 25;


public enum AuthenticationMethod implements NamedObject {
USER_DB, OAUTH2;
Expand Down Expand Up @@ -58,7 +56,7 @@ public String getName() {
/**
* the SMTP port to connect to on SMTP server.
*/
private final Integer _smtpPort;
private final int _smtpPort;

/**
* Determines whether to use TLS when connecting to SMTP server.
Expand Down Expand Up @@ -294,7 +292,7 @@ public Optional<String> getSmtpPassword() {
}

public int getSmtpPort() {
return _smtpPort == null ? DEFAULT_SMTP_PORT : _smtpPort;
return _smtpPort;
}

public boolean isSmtpTlsEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public class ModelConfigBuilder {

private static final Logger LOG = Logger.getLogger(ModelConfigBuilder.class);
private static final int DEFAULT_SMTP_PORT = 25;

// basic model information
private String _modelName;
Expand All @@ -40,7 +41,7 @@ public class ModelConfigBuilder {
private String _smtpServer;
private String _smtpUsername;
private String _smtpPassword;
private int _smtpPort;
private Integer _smtpPort;
private boolean _smtpTlsEnabled;
private String _supportEmail;
private List<String> _adminEmails = Collections.emptyList();
Expand Down Expand Up @@ -100,6 +101,7 @@ public ModelConfig build() throws WdkModelException {
Optional<String> smtpUsername = Optional.ofNullable(_smtpUsername).filter(s -> !s.isBlank());
Optional<String> smtpPassword = Optional.ofNullable(_smtpPassword).filter(s -> !s.isBlank());
String smtpServer = _smtpServer == null ? "localhost" : _smtpServer;
int smtpPort = _smtpPort == null ? DEFAULT_SMTP_PORT : _smtpPort;

return new ModelConfig(

Expand All @@ -126,7 +128,7 @@ public ModelConfig build() throws WdkModelException {
smtpServer,
smtpUsername,
smtpPassword,
_smtpPort,
smtpPort,
_smtpTlsEnabled,
_supportEmail,
_adminEmails,
Expand Down

0 comments on commit f73490c

Please sign in to comment.