aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 09:40:28 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 09:40:28 +1200
commit36c62f0f2ca21ccd5040f8529f446b1b697dba69 (patch)
tree55990e2148485f46082b6b7b23c8f18f4def21b1
parentf24bf23ed026abe684cc893924d8a17de065b220 (diff)
downloadtrackermap-server-36c62f0f2ca21ccd5040f8529f446b1b697dba69.tar.gz
trackermap-server-36c62f0f2ca21ccd5040f8529f446b1b697dba69.tar.bz2
trackermap-server-36c62f0f2ca21ccd5040f8529f446b1b697dba69.zip
Fix EV07 login decoding
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index 8bfb4fb36..05994b697 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -133,7 +133,11 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
if (sentence.startsWith("!1,")) {
- getDeviceSession(channel, remoteAddress, sentence.substring(3, sentence.length()));
+ int index = sentence.indexOf(',', 3);
+ if (index < 0) {
+ index = sentence.length();
+ }
+ getDeviceSession(channel, remoteAddress, sentence.substring(3, index));
return null;
}
diff --git a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
index fd16df779..b9003a25d 100644
--- a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class MiniFinderProtocolDecoderTest extends ProtocolTest {
MiniFinderProtocolDecoder decoder = new MiniFinderProtocolDecoder(new MiniFinderProtocol());
verifyNull(decoder, text(
+ "!1,867273023933661,V07S.5701.1621,100"));
+
+ verifyNull(decoder, text(
"!1,123456789012345"));
verifyNull(decoder, text(