From ab8fc4daef86295f9bab39890aa6de2e51342400 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 24 Nov 2016 22:37:09 +1300 Subject: Fix exception in TK103 protocol (fix #2598) --- src/org/traccar/protocol/Tk103ProtocolDecoder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index 9d04483c1..d3bc0efdc 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -113,9 +113,11 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { String type = sentence.substring(12, 16); if (type.equals("BP00") || type.equals("BP05")) { String content = sentence.substring(16); - getDeviceSession(channel, remoteAddress, content.substring(0, 15)); + if (content.length() >= 15) { + getDeviceSession(channel, remoteAddress, content.substring(0, 15)); + } if (type.equals("BP00")) { - channel.write("(" + id + "AP01" + content.substring(15) + ")"); + channel.write("(" + id + "AP01HSO)"); return null; } else if (type.equals("BP05")) { channel.write("(" + id + "AP05)"); -- cgit v1.2.3