aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification/PropertiesProvider.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-09-07 15:31:28 +0500
committerAbyss777 <abyss@fox5.ru>2017-09-07 15:35:48 +0500
commitee28d68243892623df7f718d50cd3ea5791f35ee (patch)
treea3c474d75b2393149bd89a2a9b9580444ba00a61 /src/org/traccar/notification/PropertiesProvider.java
parent9ebd2a934a5ca3a61863f839733bff321ba30296 (diff)
downloadtrackermap-server-ee28d68243892623df7f718d50cd3ea5791f35ee.tar.gz
trackermap-server-ee28d68243892623df7f718d50cd3ea5791f35ee.tar.bz2
trackermap-server-ee28d68243892623df7f718d50cd3ea5791f35ee.zip
Optimize values parsing
Diffstat (limited to 'src/org/traccar/notification/PropertiesProvider.java')
-rw-r--r--src/org/traccar/notification/PropertiesProvider.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/notification/PropertiesProvider.java b/src/org/traccar/notification/PropertiesProvider.java
index 1a4104d2b..c5ba688e8 100644
--- a/src/org/traccar/notification/PropertiesProvider.java
+++ b/src/org/traccar/notification/PropertiesProvider.java
@@ -51,10 +51,13 @@ public class PropertiesProvider {
public int getInteger(String key, int defaultValue) {
if (config != null) {
return config.getInteger(key, defaultValue);
- } else if (extendedModel.getAttributes().containsKey(key)) {
- return Integer.parseInt(extendedModel.getAttributes().get(key).toString());
} else {
- return defaultValue;
+ Object result = extendedModel.getAttributes().get(key);
+ if (result != null) {
+ return result instanceof String ? Integer.parseInt((String) result) : (Integer) result;
+ } else {
+ return defaultValue;
+ }
}
}