diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-01 21:59:48 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-01 21:59:48 -0700 |
commit | 0d491bc058de127bbcc8c014fe9a18e89544f1bb (patch) | |
tree | 70bdd57cb74de07642b716ea57528b52bcd793fc /src | |
parent | 1af92658dc079970ae4505c0503ba96723e65344 (diff) | |
download | traccar-server-0d491bc058de127bbcc8c014fe9a18e89544f1bb.tar.gz traccar-server-0d491bc058de127bbcc8c014fe9a18e89544f1bb.tar.bz2 traccar-server-0d491bc058de127bbcc8c014fe9a18e89544f1bb.zip |
Ignore empty locations (fix #4687)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java | 5 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java index 2bfc08c75..ad7dfa886 100644 --- a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java @@ -179,6 +179,9 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); + + } else { + continue; } } else if (message.contains("$WIFI")) { @@ -220,7 +223,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { positions.add(position); } - return positions; + return positions.isEmpty() ? null : positions; } } diff --git a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java index bc1c8e112..b747fa960 100644 --- a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java @@ -11,6 +11,10 @@ public class Tlt2hProtocolDecoderTest extends ProtocolTest { var decoder = new Tlt2hProtocolDecoder(null); + verifyNull(decoder, text( + "#860517049471362#MT700#0000#AUTO#1\r\n", + "#36$GPRMC,,V,,,,,,,,,,A*5C\r\n")); + verifyPositions(decoder, text( "#867198059727390#MT700#0000#AUTO#1\r\n", "#38$GPRMC,105721.00,A,2238.3071,N,11401.7575,E,,96.70,250321,,,A*74\r\n")); |