From 98c2e3da5ea0670360078a3f278ddef7d9e39953 Mon Sep 17 00:00:00 2001 From: kamaci Date: Sun, 18 Oct 2020 23:50:12 +0300 Subject: Redundant string operations are removed. --- src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java | 2 +- src/main/java/org/traccar/protocol/L100ProtocolDecoder.java | 2 +- src/main/java/org/traccar/protocol/V680ProtocolDecoder.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/traccar') diff --git a/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java index e00d83061..9b672cacc 100644 --- a/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -408,7 +408,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { } } - if (sentence.substring(21, 21 + 2).equals("vr")) { + if (sentence.startsWith("vr", 21)) { return decodePhoto(channel, remoteAddress, sentence); } else if (sentence.substring(21, 21 + 3).contains("OBD")) { return decodeObd(channel, remoteAddress, sentence); diff --git a/src/main/java/org/traccar/protocol/L100ProtocolDecoder.java b/src/main/java/org/traccar/protocol/L100ProtocolDecoder.java index 9868de435..5b5eb7d60 100644 --- a/src/main/java/org/traccar/protocol/L100ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/L100ProtocolDecoder.java @@ -138,7 +138,7 @@ public class L100ProtocolDecoder extends BaseProtocolDecoder { String sentence = (String) msg; if (sentence.startsWith("L") || sentence.startsWith("H")) { - if (sentence.substring(2, 8).equals("ATLOBD")) { + if (sentence.startsWith("ATLOBD", 2)) { return decodeObdData(channel, remoteAddress, sentence); } else { return decodeObdLocation(channel, remoteAddress, sentence); diff --git a/src/main/java/org/traccar/protocol/V680ProtocolDecoder.java b/src/main/java/org/traccar/protocol/V680ProtocolDecoder.java index 0342404a6..40267022b 100644 --- a/src/main/java/org/traccar/protocol/V680ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/V680ProtocolDecoder.java @@ -62,7 +62,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { if (sentence.length() == 16) { - getDeviceSession(channel, remoteAddress, sentence.substring(1, sentence.length())); + getDeviceSession(channel, remoteAddress, sentence.substring(1)); } else { -- cgit v1.2.3