aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-24 20:18:57 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-24 20:18:57 -0800
commit5a854ce946cc49dbb176b5a436a1b1d6673ba096 (patch)
tree610883b134698c1b23f45439f453716cd3e0fbab /src/main
parenta8af4b7d0b7eec1e3076bd51bc2e81c6df0626ac (diff)
downloadtrackermap-server-5a854ce946cc49dbb176b5a436a1b1d6673ba096.tar.gz
trackermap-server-5a854ce946cc49dbb176b5a436a1b1d6673ba096.tar.bz2
trackermap-server-5a854ce946cc49dbb176b5a436a1b1d6673ba096.zip
Handle empty response
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java b/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
index d1e079711..aff722c46 100644
--- a/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
@@ -27,6 +27,7 @@ import org.traccar.model.Position;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonObject;
+import javax.json.JsonValue;
import java.io.StringReader;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
@@ -49,7 +50,7 @@ public class OrbcommProtocolDecoder extends BaseProtocolDecoder {
String content = response.content().toString(StandardCharsets.UTF_8);
JsonObject json = Json.createReader(new StringReader(content)).readObject();
- if (channel != null) {
+ if (channel != null && !json.getString("NextStartUTC").isEmpty()) {
OrbcommProtocolPoller poller =
BasePipelineFactory.getHandler(channel.pipeline(), OrbcommProtocolPoller.class);
if (poller != null) {
@@ -59,6 +60,10 @@ public class OrbcommProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (json.get("Messages").getValueType() == JsonValue.ValueType.NULL) {
+ return null;
+ }
+
LinkedList<Position> positions = new LinkedList<>();
JsonArray messages = json.getJsonArray("Messages");