diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-13 09:39:22 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-13 09:39:22 -0700 |
commit | 33733f835e88a62c4a5259ab330723b88037adf1 (patch) | |
tree | f12c710dc4dd6c21a1434f3d699a2fcdd76bb0fa /src/main/java/org/traccar/handler/DistanceHandler.java | |
parent | adbeacc62ecb91c94f6cfe7dea8e79b8f5e1c802 (diff) | |
download | trackermap-server-33733f835e88a62c4a5259ab330723b88037adf1.tar.gz trackermap-server-33733f835e88a62c4a5259ab330723b88037adf1.tar.bz2 trackermap-server-33733f835e88a62c4a5259ab330723b88037adf1.zip |
Simplify attribute check
Diffstat (limited to 'src/main/java/org/traccar/handler/DistanceHandler.java')
-rw-r--r-- | src/main/java/org/traccar/handler/DistanceHandler.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/handler/DistanceHandler.java b/src/main/java/org/traccar/handler/DistanceHandler.java index fb82b5d8e..87c4a81c9 100644 --- a/src/main/java/org/traccar/handler/DistanceHandler.java +++ b/src/main/java/org/traccar/handler/DistanceHandler.java @@ -49,7 +49,7 @@ public class DistanceHandler extends BaseDataHandler { protected Position handlePosition(Position position) { double distance = 0.0; - if (position.getAttributes().containsKey(Position.KEY_DISTANCE)) { + if (position.hasAttribute(Position.KEY_DISTANCE)) { distance = position.getDouble(Position.KEY_DISTANCE); } double totalDistance = 0.0; @@ -57,7 +57,7 @@ public class DistanceHandler extends BaseDataHandler { Position last = cacheManager.getPosition(position.getDeviceId()); if (last != null) { totalDistance = last.getDouble(Position.KEY_TOTAL_DISTANCE); - if (!position.getAttributes().containsKey(Position.KEY_DISTANCE)) { + if (!position.hasAttribute(Position.KEY_DISTANCE)) { distance = DistanceCalculator.distance( position.getLatitude(), position.getLongitude(), last.getLatitude(), last.getLongitude()); |