diff options
Diffstat (limited to 'src/org/traccar/protocol/H02FrameDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/H02FrameDecoder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/H02FrameDecoder.java b/src/org/traccar/protocol/H02FrameDecoder.java index f1d305ab6..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; @@ -81,7 +86,7 @@ public class H02FrameDecoder extends FrameDecoder { default: - throw new IllegalArgumentException(); + return null; } return null; |