From 64a84fcb0a61d2a4cdb0d329f309cc0af3339e93 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 5 Jul 2020 19:06:26 -0700 Subject: Fix analysis issues --- src/main/java/org/traccar/WebDataHandler.java | 4 ++-- src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java | 1 + src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/traccar/WebDataHandler.java b/src/main/java/org/traccar/WebDataHandler.java index d6bfb126b..3be575b48 100644 --- a/src/main/java/org/traccar/WebDataHandler.java +++ b/src/main/java/org/traccar/WebDataHandler.java @@ -187,14 +187,14 @@ public class WebDataHandler extends BaseDataHandler { private int retries = 0; private Map payload; - private Invocation.Builder requestBuilder; + private final Invocation.Builder requestBuilder; private MediaType mediaType = MediaType.APPLICATION_JSON_TYPE; AsyncRequestAndCallback(Position position) { String formattedUrl; try { - formattedUrl = (json && !urlVariables) ? url : formatRequest(position); + formattedUrl = json && !urlVariables ? url : formatRequest(position); } catch (UnsupportedEncodingException | JsonProcessingException e) { throw new RuntimeException("Forwarding formatting error", e); } diff --git a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java index b1c13d486..846b33396 100644 --- a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java @@ -91,6 +91,7 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder { switch (BitUtil.between(field, 2, 5)) { case 0b000: position.set("bus", BitUtil.to(field, 2)); + break; case 0b001: position.set("currentGear", BitUtil.to(field, 2)); break; diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 3d6f5b8a5..5472b272d 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -667,10 +667,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // alert modifier } - if (BitUtil.check(mask, 21)) { - if (alertId == 59) { - position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8))); - } + if (BitUtil.check(mask, 21) && alertId == 59) { + position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8))); } return position; -- cgit v1.2.3