aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-04 22:22:07 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-04 22:22:07 +1300
commit206600cd599e03eaa095619fc8a52b742d3413a1 (patch)
treeaf6c677f54c987c7c7ba5e1d75c1c30796e1b860 /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parenta59ca5006a4d3547fbbb2931ad8a163f332ad65b (diff)
downloadtrackermap-server-206600cd599e03eaa095619fc8a52b742d3413a1.tar.gz
trackermap-server-206600cd599e03eaa095619fc8a52b742d3413a1.tar.bz2
trackermap-server-206600cd599e03eaa095619fc8a52b742d3413a1.zip
Added unknown device logging (fix #102)
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index b658c74e8..d5658b9a2 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.GenericProtocolDecoder;
import org.traccar.helper.Crc;
+import org.traccar.helper.Log;
import org.traccar.model.DataManager;
import org.traccar.model.Position;
@@ -133,7 +134,13 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder {
// Get device by id
// TODO: change imei to unique id
- position.setDeviceId(getDataManager().getDeviceByImei(getId(buf)).getId());
+ String id = getId(buf);
+ try {
+ position.setDeviceId(getDataManager().getDeviceByImei(id).getId());
+ } catch(Exception error) {
+ Log.warning("Unknown device - " + id);
+ return null;
+ }
// Parse message
String sentence = buf.toString(offset, buf.readableBytes() - offset - 4, Charset.defaultCharset());