aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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(