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/Mta6ProtocolDecoder.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/org/traccar/protocol/Mta6ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index bc8d95551..aea6cbddc 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -15,11 +15,6 @@ */ package org.traccar.protocol; -import java.net.SocketAddress; -import java.nio.charset.Charset; -import java.util.Date; -import java.util.LinkedList; -import java.util.List; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; @@ -36,6 +31,12 @@ import org.traccar.helper.Log; import org.traccar.model.Event; import org.traccar.model.Position; +import java.net.SocketAddress; +import java.nio.charset.StandardCharsets; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + public class Mta6ProtocolDecoder extends BaseProtocolDecoder { private final boolean simple; @@ -55,7 +56,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK); - ChannelBuffer begin = ChannelBuffers.copiedBuffer("#ACK#", Charset.defaultCharset()); + ChannelBuffer begin = ChannelBuffers.copiedBuffer("#ACK#", StandardCharsets.US_ASCII); ChannelBuffer end = ChannelBuffers.directBuffer(3); end.writeByte(packetId); end.writeByte(packetCount); @@ -282,7 +283,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes("id=".length()); int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '&'); - String uniqueId = buf.toString(buf.readerIndex(), index - buf.readerIndex(), Charset.defaultCharset()); + String uniqueId = buf.toString(buf.readerIndex(), index - buf.readerIndex(), StandardCharsets.US_ASCII); if (!identify(uniqueId, channel, remoteAddress)) { return null; } -- cgit v1.2.3