aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TotemFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-04 13:26:16 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-04 13:26:16 +1200
commit4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b (patch)
tree2b6d67fa7164d6b0cb41d3c5162556818b53cd1c /src/org/traccar/protocol/TotemFrameDecoder.java
parent2d920ecec746615281802e068044a3122a0ae90b (diff)
downloadtrackermap-server-4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b.tar.gz
trackermap-server-4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b.tar.bz2
trackermap-server-4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b.zip
Explicitly use ASCII charset
Diffstat (limited to 'src/org/traccar/protocol/TotemFrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/TotemFrameDecoder.java7
1 files changed, 4 insertions, 3 deletions
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()) {