aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Piet Mens <jpmens@gmail.com>2017-06-15 00:43:47 +0200
committerJan-Piet Mens <jpmens@gmail.com>2017-06-15 00:43:47 +0200
commitb52688409736837d952f10865be754e23120f42c (patch)
treea9888a9d4790afd4e4d96a23a490181bd9c2f6b3
parentd01591f1c0de50b6aa399b0ece00d422897a48e5 (diff)
downloadtraccar-server-b52688409736837d952f10865be754e23120f42c.tar.gz
traccar-server-b52688409736837d952f10865be754e23120f42c.tar.bz2
traccar-server-b52688409736837d952f10865be754e23120f42c.zip
more review
-rw-r--r--src/org/traccar/protocol/OwnTracksProtocolDecoder.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/OwnTracksProtocolDecoder.java b/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
index 4bff3c7ed..f1dd2401a 100644
--- a/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
+++ b/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
@@ -94,15 +94,17 @@ public class OwnTracksProtocolDecoder extends BaseProtocolDecoder {
position.setTime(new Date(root.getJsonNumber("tst").longValue() * 1000));
- String uniqueId = "";
- if (root.containsKey("tid")) {
- uniqueId = root.getString("tid");
- }
- if (root.containsKey("topic")) {
+ Boolean haveTopic = root.containsKey("topic");
+ Boolean haveTid = root.containsKey("tid");
+ String uniqueId = null;
+
+ if (haveTopic) {
uniqueId = root.getString("topic");
- if (root.containsKey("tid")) {
+ if (haveTid) {
position.set("tid", root.getString("tid"));
}
+ } else {
+ uniqueId = root.getString("tid");
}
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, uniqueId);
@@ -115,5 +117,4 @@ public class OwnTracksProtocolDecoder extends BaseProtocolDecoder {
sendResponse(channel, HttpResponseStatus.OK);
return position;
}
-
}