diff options
author | Jan-Piet Mens <jpmens@gmail.com> | 2017-06-15 00:43:47 +0200 |
---|---|---|
committer | Jan-Piet Mens <jpmens@gmail.com> | 2017-06-15 00:43:47 +0200 |
commit | b52688409736837d952f10865be754e23120f42c (patch) | |
tree | a9888a9d4790afd4e4d96a23a490181bd9c2f6b3 /src/org/traccar | |
parent | d01591f1c0de50b6aa399b0ece00d422897a48e5 (diff) | |
download | trackermap-server-b52688409736837d952f10865be754e23120f42c.tar.gz trackermap-server-b52688409736837d952f10865be754e23120f42c.tar.bz2 trackermap-server-b52688409736837d952f10865be754e23120f42c.zip |
more review
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/OwnTracksProtocolDecoder.java | 15 |
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; } - } |