aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-30 07:05:56 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-30 07:05:56 +1300
commitcece144cb40875887800251e20b9d44cb609052f (patch)
tree93a0c6ed10663ba093d972d488ae5f0c58676057
parent6461a7fad516e46250daca301305f36ba8bab8e6 (diff)
downloadtrackermap-server-cece144cb40875887800251e20b9d44cb609052f.tar.gz
trackermap-server-cece144cb40875887800251e20b9d44cb609052f.tar.bz2
trackermap-server-cece144cb40875887800251e20b9d44cb609052f.zip
Handle empty Starlink cell info
-rw-r--r--src/org/traccar/protocol/StarLinkProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/StarLinkProtocolDecoderTest.java6
2 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
index 8d35ea5ba..97091257f 100644
--- a/src/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -151,10 +151,14 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_OUT + 4, Integer.parseInt(data[i]));
break;
case "#LAC#":
- lac = Integer.parseInt(data[i]);
+ if (!data[i].isEmpty()) {
+ lac = Integer.parseInt(data[i]);
+ }
break;
case "#CID#":
- cid = Integer.parseInt(data[i]);
+ if (!data[i].isEmpty()) {
+ cid = Integer.parseInt(data[i]);
+ }
break;
case "#VIN#":
position.set(Position.KEY_POWER, Double.parseDouble(data[i]));
diff --git a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index d102ba426..8726b1e18 100644
--- a/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
StarLinkProtocolDecoder decoder = new StarLinkProtocolDecoder(new StarLinkProtocol());
verifyPosition(decoder, text(
+ "$SLU031B2B,06,622,170329035057,01,170329035057,+3158.0018,+03446.6968,004.9,007,000099,1,1,0,0,0,0,0,0,,,14.176,03.826,,1,1,1,4*B0"));
+
+ verifyPosition(decoder, text(
+ "$SLU031B2B,06,624,170329035143,01,170329035143,+3158.0171,+03446.6742,006.8,326,000099,1,1,0,0,0,0,0,0,10452,8723,14.212,03.827,,1,1,1,4*6D"));
+
+ verifyPosition(decoder, text(
"$SLU0330D5,06,3556,170314063523,19,170314061634,+3211.7187,+03452.8106,000.0,332,015074,1,1,0,0,0,0,0,0,10443,32722,12.870,03.790,,0,0*FC"));
verifyPosition(decoder, text(