aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeitrackFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-03-17 09:41:52 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-03-17 09:41:52 +1300
commit5adbbcff629056c0d811c9fd22e6a6af82c65ba9 (patch)
treee7ff84725899129deead8d8047f44560b1d760b0 /src/org/traccar/protocol/MeitrackFrameDecoder.java
parente1166b00b94af5be3e3587581f09a5e039cfaecd (diff)
downloadtrackermap-server-5adbbcff629056c0d811c9fd22e6a6af82c65ba9.tar.gz
trackermap-server-5adbbcff629056c0d811c9fd22e6a6af82c65ba9.tar.bz2
trackermap-server-5adbbcff629056c0d811c9fd22e6a6af82c65ba9.zip
Fix Meitrack frame decoder
Diffstat (limited to 'src/org/traccar/protocol/MeitrackFrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeitrackFrameDecoder.java4
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);
}