aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java1
-rw-r--r--test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index c8671bc54..e4e6cb300 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -62,6 +62,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
throws Exception {
String sentence = (String) msg;
+ sentence = sentence.trim();
// Decode header
String header = sentence.substring(0, sentence.indexOf('\r'));
diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index 0a7dede6c..350df23b4 100644
--- a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -15,6 +15,10 @@ public class Tlt2hProtocolDecoderTest {
verify(decoder.decode(null, null,
"#357671030946351#V500#0000#AUTO#1\r\n" +
"#$GPRMC,223835.000,A,0615.3545,S,10708.5779,E,14.62,97.41,070313,,,D*70\r\n"));
+
+ verify(decoder.decode(null, null,
+ "\r\n#357671030946351#V500#0000#AUTO#1\r\n" +
+ "#$GPRMC,223835.000,A,0615.3545,S,10708.5779,E,14.62,97.41,070313,,,D*70\r\n"));
verify(decoder.decode(null, null,
"#357671030938911#V500#0000#AUTOSTOP#1\r\n" +