From f872b2072cfd35c51a94efc5b93b91e46129d48e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 28 Feb 2015 09:28:16 +1300 Subject: Fix Wondex frame decoder (fix #1103) --- src/org/traccar/helper/ChannelBufferTools.java | 4 ++-- src/org/traccar/protocol/WondexFrameDecoder.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java index 0de07610d..09e3d5191 100644 --- a/src/org/traccar/helper/ChannelBufferTools.java +++ b/src/org/traccar/helper/ChannelBufferTools.java @@ -30,13 +30,13 @@ public class ChannelBufferTools { public static Integer find( ChannelBuffer buf, Integer start, - Integer length, + Integer finish, String subString) { int index = start; boolean match; - for (; index < length; index++) { + for (; index < finish; index++) { match = true; for (int i = 0; i < subString.length(); i++) { diff --git a/src/org/traccar/protocol/WondexFrameDecoder.java b/src/org/traccar/protocol/WondexFrameDecoder.java index ba1d41c53..09971c0d9 100644 --- a/src/org/traccar/protocol/WondexFrameDecoder.java +++ b/src/org/traccar/protocol/WondexFrameDecoder.java @@ -45,7 +45,7 @@ public class WondexFrameDecoder extends FrameDecoder { } else { - Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.readableBytes(), "\r\n"); + Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.writerIndex(), "\r\n"); if (index != null) { ChannelBuffer frame = buf.readBytes(index - buf.readerIndex()); buf.skipBytes(2); -- cgit v1.2.3