From 5adbbcff629056c0d811c9fd22e6a6af82c65ba9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 17 Mar 2015 09:41:52 +1300 Subject: Fix Meitrack frame decoder --- src/org/traccar/protocol/MeitrackFrameDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') 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); } -- cgit v1.2.3