From fa3e682e2b309ca89d0cc7dcb11957f9b380c6d4 Mon Sep 17 00:00:00 2001 From: Anatoliy Golubev Date: Sun, 10 Sep 2017 11:43:13 +0300 Subject: Fix command response decode --- src/org/traccar/protocol/AdmProtocolDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/AdmProtocolDecoder.java b/src/org/traccar/protocol/AdmProtocolDecoder.java index df96c6b8d..80c580967 100644 --- a/src/org/traccar/protocol/AdmProtocolDecoder.java +++ b/src/org/traccar/protocol/AdmProtocolDecoder.java @@ -127,7 +127,11 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder { getLastLocation(position, null); - position.set(Position.KEY_RESULT, buf.readBytes(129).toString(StandardCharsets.UTF_8)); + int responseTextLength = buf.bytesBefore((byte) 0); + if (responseTextLength < 0) { + responseTextLength = CMD_RESPONSE_SIZE - 3; + } + position.set(Position.KEY_RESULT, buf.readBytes(responseTextLength).toString(StandardCharsets.UTF_8)); return position; } -- cgit v1.2.3