From 4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 4 May 2016 13:26:16 +1200 Subject: Explicitly use ASCII charset --- src/org/traccar/protocol/TotemFrameDecoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/protocol/TotemFrameDecoder.java') diff --git a/src/org/traccar/protocol/TotemFrameDecoder.java b/src/org/traccar/protocol/TotemFrameDecoder.java index 83c328173..374161758 100644 --- a/src/org/traccar/protocol/TotemFrameDecoder.java +++ b/src/org/traccar/protocol/TotemFrameDecoder.java @@ -15,13 +15,14 @@ */ package org.traccar.protocol; -import java.nio.charset.Charset; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.handler.codec.frame.FrameDecoder; import org.traccar.helper.StringFinder; +import java.nio.charset.StandardCharsets; + public class TotemFrameDecoder extends FrameDecoder { @Override @@ -43,9 +44,9 @@ public class TotemFrameDecoder extends FrameDecoder { int flagIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("AA")); if (flagIndex != -1 && flagIndex - beginIndex == 6) { - length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, Charset.defaultCharset())); + length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, StandardCharsets.US_ASCII)); } else { - length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, Charset.defaultCharset()), 16); + length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, StandardCharsets.US_ASCII), 16); } if (length <= buf.readableBytes()) { -- cgit v1.2.3