aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoliy Golubev <darth.naihil@gmail.com>2017-09-10 11:43:13 +0300
committerAnatoliy Golubev <darth.naihil@gmail.com>2017-09-10 11:43:13 +0300
commitfa3e682e2b309ca89d0cc7dcb11957f9b380c6d4 (patch)
tree573a0f02a7add94ca49bd98198dc10980c207bb4
parent31d46d03bd29e9d29c2797f5e72735450a9bf45b (diff)
downloadtrackermap-server-fa3e682e2b309ca89d0cc7dcb11957f9b380c6d4.tar.gz
trackermap-server-fa3e682e2b309ca89d0cc7dcb11957f9b380c6d4.tar.bz2
trackermap-server-fa3e682e2b309ca89d0cc7dcb11957f9b380c6d4.zip
Fix command response decode
-rw-r--r--src/org/traccar/protocol/AdmProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
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;
}