diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-19 21:28:40 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-19 21:28:40 +1300 |
commit | 9ddf8e2aeb98958d50ecb11ae6818359ade76325 (patch) | |
tree | 51a7cc831e283ce07a5fe80c6137f7f108d5d16d /src | |
parent | 04b35596c86b0cd4b06ce54c26ed84c6166e10b4 (diff) | |
download | traccar-server-9ddf8e2aeb98958d50ecb11ae6818359ade76325.tar.gz traccar-server-9ddf8e2aeb98958d50ecb11ae6818359ade76325.tar.bz2 traccar-server-9ddf8e2aeb98958d50ecb11ae6818359ade76325.zip |
Fix readString in atrack decoder
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/AtrackProtocolDecoder.java | 8 |
1 files changed, 4 insertions, 4 deletions
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; |