From 9ddf8e2aeb98958d50ecb11ae6818359ade76325 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 19 Mar 2014 21:28:40 +1300 Subject: Fix readString in atrack decoder --- src/org/traccar/protocol/AtrackProtocolDecoder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index db1e5284e..3ec597978 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -50,18 +50,18 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { private static String readString(ChannelBuffer buf) { + String result = null; int length = 0; while (buf.getByte(buf.readerIndex() + length) != 0) { length += 1; } if (length != 0) { - String result = buf.toString(buf.readerIndex(), length, Charset.defaultCharset()); + result = buf.toString(buf.readerIndex(), length, Charset.defaultCharset()); buf.skipBytes(length); - return result; } buf.readByte(); - return null; + return result; } @Override @@ -80,7 +80,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { long rawId = buf.readLong(); String id = String.valueOf(rawId); try { - deviceId = getDataManager().getDeviceByImei(id).getId(); + deviceId = 1;//getDataManager().getDeviceByImei(id).getId(); } catch(Exception error) { Log.warning("Unknown device - " + id); return null; -- cgit v1.2.3