aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Stl060FrameDecoder.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/Stl060FrameDecoder.java b/src/org/traccar/protocol/Stl060FrameDecoder.java
index 119abfbe3..32ff5135b 100644
--- a/src/org/traccar/protocol/Stl060FrameDecoder.java
+++ b/src/org/traccar/protocol/Stl060FrameDecoder.java
@@ -29,20 +29,17 @@ public class Stl060FrameDecoder extends CharacterDelimiterFrameDecoder {
@Override
protected Object decode(
- ChannelHandlerContext ctx,
- Channel channel,
- ChannelBuffer buf) throws Exception {
+ ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception {
ChannelBuffer result = (ChannelBuffer) super.decode(ctx, channel, buf);
if (result != null) {
- Integer beginIndex = ChannelBufferTools.find(
- result, 0, result.readableBytes(), "$");
- if (beginIndex == null) {
+ int index = result.indexOf(result.readerIndex(), result.writerIndex(), (byte) '$');
+ if (index == -1) {
return result;
} else {
- result.skipBytes(beginIndex);
+ result.skipBytes(index);
return result.readBytes(result.readableBytes());
}