aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/MeitrackFrameDecoder.java8
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java2
2 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/MeitrackFrameDecoder.java b/src/org/traccar/protocol/MeitrackFrameDecoder.java
index e96359104..e34116fa4 100644
--- a/src/org/traccar/protocol/MeitrackFrameDecoder.java
+++ b/src/org/traccar/protocol/MeitrackFrameDecoder.java
@@ -26,16 +26,14 @@ public class MeitrackFrameDecoder extends FrameDecoder {
@Override
protected Object decode(
- ChannelHandlerContext ctx,
- Channel channel,
- ChannelBuffer buf) throws Exception {
+ ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception {
if (buf.readableBytes() < 10) {
return null;
}
- Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.writerIndex(), ",");
- if (index != null) {
+ int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
+ if (index != -1) {
int length = index - buf.readerIndex() + Integer.parseInt(
buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, Charset.defaultCharset()));
if (buf.readableBytes() >= length) {
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index f8eb6ed91..3aae0542b 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -267,7 +267,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
// Find type
- Integer index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
+ int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
index = buf.indexOf(index + 1, buf.writerIndex(), (byte) ',');
String type = buf.toString(index + 1, 3, Charset.defaultCharset());