diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-07 23:03:45 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-07 23:03:45 +1200 |
commit | 7294d12706466840562b073a5a58a3696c0e54da (patch) | |
tree | a3c474d75b2393149bd89a2a9b9580444ba00a61 /src/org/traccar/notification | |
parent | f0578c7b5f8737e019a9cf05935d2caaa940f0ca (diff) | |
parent | ee28d68243892623df7f718d50cd3ea5791f35ee (diff) | |
download | trackermap-server-7294d12706466840562b073a5a58a3696c0e54da.tar.gz trackermap-server-7294d12706466840562b073a5a58a3696c0e54da.tar.bz2 trackermap-server-7294d12706466840562b073a5a58a3696c0e54da.zip |
Merge pull request #3511 from Abyss777/attributes_types
Handle correct and incorrect attribute types
Diffstat (limited to 'src/org/traccar/notification')
-rw-r--r-- | src/org/traccar/notification/NotificationMail.java | 2 | ||||
-rw-r--r-- | src/org/traccar/notification/PropertiesProvider.java | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index d7f3bf64c..fc70a6115 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -43,7 +43,7 @@ public final class NotificationMail { if (host != null) { properties.put("mail.transport.protocol", provider.getString("mail.transport.protocol", "smtp")); properties.put("mail.smtp.host", host); - properties.put("mail.smtp.port", provider.getString("mail.smtp.port", "25")); + properties.put("mail.smtp.port", String.valueOf(provider.getInteger("mail.smtp.port", 25))); String starttlsEnable = provider.getString("mail.smtp.starttls.enable"); if (starttlsEnable != null) { diff --git a/src/org/traccar/notification/PropertiesProvider.java b/src/org/traccar/notification/PropertiesProvider.java index 2fea901af..c5ba688e8 100644 --- a/src/org/traccar/notification/PropertiesProvider.java +++ b/src/org/traccar/notification/PropertiesProvider.java @@ -48,4 +48,17 @@ public class PropertiesProvider { return value; } + public int getInteger(String key, int defaultValue) { + if (config != null) { + return config.getInteger(key, defaultValue); + } else { + Object result = extendedModel.getAttributes().get(key); + if (result != null) { + return result instanceof String ? Integer.parseInt((String) result) : (Integer) result; + } else { + return defaultValue; + } + } + } + } |