From c6d6288d37a000cf364dce4753c24924f9fcc7de Mon Sep 17 00:00:00 2001 From: Kevin Goos Date: Wed, 18 Jul 2018 15:48:32 +0200 Subject: Added integer checking for valid in osmand --- src/org/traccar/protocol/OsmAndProtocolDecoder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index c75e9519c..94055a282 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -70,7 +70,13 @@ public class OsmAndProtocolDecoder extends BaseHttpProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); break; case "valid": - position.setValid(Boolean.parseBoolean(value)); + if (value == "1") { + position.setValid(true); + } else if (value == "0") { + position.setValid(false); + } else { + position.setValid(Boolean.parseBoolean(value)); + } break; case "timestamp": try { -- cgit v1.2.3 From b8f17ea08288c62f22133156364f444b1e25c74b Mon Sep 17 00:00:00 2001 From: Kevin Goos Date: Thu, 19 Jul 2018 10:35:57 +0200 Subject: Fixed osmand code making it more elegant and fixing mistake --- src/org/traccar/protocol/OsmAndProtocolDecoder.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index 94055a282..b270b6071 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -70,13 +70,7 @@ public class OsmAndProtocolDecoder extends BaseHttpProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); break; case "valid": - if (value == "1") { - position.setValid(true); - } else if (value == "0") { - position.setValid(false); - } else { - position.setValid(Boolean.parseBoolean(value)); - } + position.setValid(Boolean.parseBoolean(value) || "1".equals(value)); break; case "timestamp": try { -- cgit v1.2.3