diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-03-17 09:41:52 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-03-17 09:41:52 +1300 |
commit | 5adbbcff629056c0d811c9fd22e6a6af82c65ba9 (patch) | |
tree | e7ff84725899129deead8d8047f44560b1d760b0 /src/org | |
parent | e1166b00b94af5be3e3587581f09a5e039cfaecd (diff) | |
download | traccar-server-5adbbcff629056c0d811c9fd22e6a6af82c65ba9.tar.gz traccar-server-5adbbcff629056c0d811c9fd22e6a6af82c65ba9.tar.bz2 traccar-server-5adbbcff629056c0d811c9fd22e6a6af82c65ba9.zip |
Fix Meitrack frame decoder
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/MeitrackFrameDecoder.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeitrackFrameDecoder.java b/src/org/traccar/protocol/MeitrackFrameDecoder.java index f7dda10e2..40be60358 100644 --- a/src/org/traccar/protocol/MeitrackFrameDecoder.java +++ b/src/org/traccar/protocol/MeitrackFrameDecoder.java @@ -34,10 +34,10 @@ public class MeitrackFrameDecoder extends FrameDecoder { return null; } - Integer index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), ","); + Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.writerIndex(), ","); if (index != null) { - int length = index + Integer.valueOf(buf.toString(3, index - 3, Charset.defaultCharset())); + int length = index - buf.readerIndex() + Integer.valueOf(buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, Charset.defaultCharset())); if (buf.readableBytes() >= length) { return buf.readBytes(length); } |