diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/helper/BufferUtil.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/helper/BufferUtil.java b/src/org/traccar/helper/BufferUtil.java index c046fcaf5..81a081182 100644 --- a/src/org/traccar/helper/BufferUtil.java +++ b/src/org/traccar/helper/BufferUtil.java @@ -33,10 +33,10 @@ public final class BufferUtil { } public static int indexOf(String needle, ByteBuf haystack, int startIndex, int endIndex) { - int index = ByteBufUtil.indexOf( - Unpooled.wrappedBuffer(needle.getBytes(StandardCharsets.US_ASCII)), - Unpooled.wrappedBuffer(haystack.array(), startIndex, endIndex - startIndex)); - return (index != -1) ? (startIndex + index) : -1; + haystack = Unpooled.wrappedBuffer(haystack); + haystack.readerIndex(startIndex); + haystack.writerIndex(endIndex); + return indexOf(needle, haystack); } } |