diff options
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java | 7 |
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"); |