From 223962059fd71881b3f210391cd4414afc3750e9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 10 Sep 2016 16:55:25 +1200 Subject: Fix Java code analytics issues --- src/org/traccar/database/DataManager.java | 2 +- src/org/traccar/protocol/EelinkProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/Pt502ProtocolDecoder.java | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 78f1b4109..abc48f063 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -305,7 +305,7 @@ public class DataManager { } public void clearPositionsHistory() throws SQLException { - int historyDays = config.getInteger("database.positionsHistoryDays"); + long historyDays = config.getInteger("database.positionsHistoryDays"); if (historyDays != 0) { QueryBuilder.create(dataSource, getQuery("database.deletePositions")) .setDate("serverTime", new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000)) diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index 24cd6b570..7403fd18a 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -126,7 +126,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { return position; } - private Position decodeNew(DeviceSession deviceSession, ChannelBuffer buf, int type, int index) { + private Position decodeNew(DeviceSession deviceSession, ChannelBuffer buf, int index) { Position position = new Position(); position.setDeviceId(deviceSession.getDeviceId()); @@ -206,7 +206,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { if (type == MSG_GPS || type == MSG_ALARM || type == MSG_STATE || type == MSG_SMS) { return decodeOld(deviceSession, buf, type, index); } else if (type >= MSG_NORMAL && type <= MSG_OBD_CODE) { - return decodeNew(deviceSession, buf, type, index); + return decodeNew(deviceSession, buf, index); } } diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index 7dc4fbe5e..24dc2094f 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -91,10 +91,8 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { String type = parser.next(); - if (type.startsWith("PHO")) { - if (channel != null) { - channel.write("#PHD0," + type.substring(3) + "\r\n"); - } + if (type.startsWith("PHO") && channel != null) { + channel.write("#PHD0," + type.substring(3) + "\r\n"); } position.set(Position.KEY_ALARM, decodeAlarm(type)); -- cgit v1.2.3