From 80fcbfcb89d7a21f838dbe5d2e9e5b6156bae1e1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 19 Nov 2016 11:47:41 +1300 Subject: Fix code analysis problems --- src/org/traccar/Config.java | 2 +- src/org/traccar/helper/PatternUtil.java | 12 +++++++ .../traccar/protocol/CastelProtocolDecoder.java | 42 +++++++++++----------- 3 files changed, 34 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/org/traccar/Config.java b/src/org/traccar/Config.java index e59c3c554..1be86fce0 100644 --- a/src/org/traccar/Config.java +++ b/src/org/traccar/Config.java @@ -40,7 +40,7 @@ public class Config { } public boolean hasKey(String key) { - return properties.containsKey(key) || (defaultProperties != null && defaultProperties.containsKey(key)); + return properties.containsKey(key) || defaultProperties != null && defaultProperties.containsKey(key); } public String getString(String key) { diff --git a/src/org/traccar/helper/PatternUtil.java b/src/org/traccar/helper/PatternUtil.java index c308012e6..12536eaef 100644 --- a/src/org/traccar/helper/PatternUtil.java +++ b/src/org/traccar/helper/PatternUtil.java @@ -33,6 +33,18 @@ public final class PatternUtil { public String getPatternMatch() { return patternMatch; } + + public String getPatternTail() { + return patternTail; + } + + public String getStringMatch() { + return stringMatch; + } + + public String getStringTail() { + return stringTail; + } } public static MatchResult checkPattern(String pattern, String input) { diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 9ac8c5240..790dcd932 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -73,27 +73,27 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { super(protocol); } - private static final short MSG_SC_LOGIN = 0x1001; - private static final short MSG_SC_LOGIN_RESPONSE = (short) 0x9001; - private static final short MSG_SC_LOGOUT = 0x1002; - private static final short MSG_SC_HEARTBEAT = 0x1003; - private static final short MSG_SC_HEARTBEAT_RESPONSE = (short) 0x9003; - private static final short MSG_SC_GPS = 0x4001; - private static final short MSG_SC_PID_DATA = 0x4002; - private static final short MSG_SC_SUPPORTED_PID = 0x4004; - private static final short MSG_SC_OBD_DATA = 0x4005; - private static final short MSG_SC_DTCS_PASSENGER = 0x4006; - private static final short MSG_SC_DTCS_COMMERCIAL = 0x400B; - private static final short MSG_SC_ALARM = 0x4007; - private static final short MSG_SC_CELL = 0x4008; - private static final short MSG_SC_GPS_SLEEP = 0x4009; - private static final short MSG_SC_AGPS_REQUEST = 0x5101; - private static final short MSG_SC_CURRENT_LOCATION = (short) 0xB001; - - private static final short MSG_CC_LOGIN = 0x4001; - private static final short MSG_CC_LOGIN_RESPONSE = (short) 0x8001; - private static final short MSG_CC_HEARTBEAT = 0x4206; - private static final short MSG_CC_HEARTBEAT_RESPONSE = (short) 0x8206; + public static final short MSG_SC_LOGIN = 0x1001; + public static final short MSG_SC_LOGIN_RESPONSE = (short) 0x9001; + public static final short MSG_SC_LOGOUT = 0x1002; + public static final short MSG_SC_HEARTBEAT = 0x1003; + public static final short MSG_SC_HEARTBEAT_RESPONSE = (short) 0x9003; + public static final short MSG_SC_GPS = 0x4001; + public static final short MSG_SC_PID_DATA = 0x4002; + public static final short MSG_SC_SUPPORTED_PID = 0x4004; + public static final short MSG_SC_OBD_DATA = 0x4005; + public static final short MSG_SC_DTCS_PASSENGER = 0x4006; + public static final short MSG_SC_DTCS_COMMERCIAL = 0x400B; + public static final short MSG_SC_ALARM = 0x4007; + public static final short MSG_SC_CELL = 0x4008; + public static final short MSG_SC_GPS_SLEEP = 0x4009; + public static final short MSG_SC_AGPS_REQUEST = 0x5101; + public static final short MSG_SC_CURRENT_LOCATION = (short) 0xB001; + + public static final short MSG_CC_LOGIN = 0x4001; + public static final short MSG_CC_LOGIN_RESPONSE = (short) 0x8001; + public static final short MSG_CC_HEARTBEAT = 0x4206; + public static final short MSG_CC_HEARTBEAT_RESPONSE = (short) 0x8206; private Position readPosition(DeviceSession deviceSession, ChannelBuffer buf) { -- cgit v1.2.3