diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-02-17 06:40:17 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-02-17 06:40:17 +1300 |
commit | 5b75e0a58fbcc11a1c66448bfbd9d3466b015668 (patch) | |
tree | bcb8acbbadce52f818d3b8191aa1b7ff5a15057f /src/org/traccar/protocol/H02FrameDecoder.java | |
parent | 25ecf5c05872b374d7b2065b07a35e6973baf914 (diff) | |
download | trackermap-server-5b75e0a58fbcc11a1c66448bfbd9d3466b015668.tar.gz trackermap-server-5b75e0a58fbcc11a1c66448bfbd9d3466b015668.tar.bz2 trackermap-server-5b75e0a58fbcc11a1c66448bfbd9d3466b015668.zip |
Fix H02 frame decoder (fix #2926)
Diffstat (limited to 'src/org/traccar/protocol/H02FrameDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/H02FrameDecoder.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/H02FrameDecoder.java b/src/org/traccar/protocol/H02FrameDecoder.java index ac3dbcc2e..391fccc87 100644 --- a/src/org/traccar/protocol/H02FrameDecoder.java +++ b/src/org/traccar/protocol/H02FrameDecoder.java @@ -50,7 +50,12 @@ public class H02FrameDecoder extends FrameDecoder { // Return text message int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '#'); if (index != -1) { - return buf.readBytes(index + 1 - buf.readerIndex()); + ChannelBuffer result = buf.readBytes(index + 1 - buf.readerIndex()); + while (buf.readable() + && (buf.getByte(buf.readerIndex()) == '\r' || buf.getByte(buf.readerIndex()) == '\n')) { + buf.readByte(); // skip new line + } + return result; } break; |