aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 13:07:02 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 13:07:02 +1200
commit70d22de4205aec294660378f0d854cbc32c7a6b8 (patch)
treeb425bcf00113b3d8bb65ba160a7723f66e12a977 /src/org/traccar
parent32c836e90bd75e68cac1d704b048a3c4ff22775f (diff)
downloadtrackermap-server-70d22de4205aec294660378f0d854cbc32c7a6b8.tar.gz
trackermap-server-70d22de4205aec294660378f0d854cbc32c7a6b8.tar.bz2
trackermap-server-70d22de4205aec294660378f0d854cbc32c7a6b8.zip
Fix code analytics issues
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/geocode/GeocodeFarmReverseGeocoder.java6
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java1
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/HuaShengFrameDecoder.java1
-rw-r--r--src/org/traccar/protocol/HuaShengProtocol.java1
-rw-r--r--src/org/traccar/protocol/HuaShengProtocolDecoder.java15
6 files changed, 13 insertions, 15 deletions
diff --git a/src/org/traccar/geocode/GeocodeFarmReverseGeocoder.java b/src/org/traccar/geocode/GeocodeFarmReverseGeocoder.java
index e100d3081..306fc25b8 100644
--- a/src/org/traccar/geocode/GeocodeFarmReverseGeocoder.java
+++ b/src/org/traccar/geocode/GeocodeFarmReverseGeocoder.java
@@ -19,12 +19,14 @@ import javax.json.JsonObject;
public class GeocodeFarmReverseGeocoder extends JsonReverseGeocoder {
+ private static final String URL = "https://www.geocode.farm/v3/json/reverse/";
+
public GeocodeFarmReverseGeocoder(int cacheSize) {
- super("https://www.geocode.farm/v3/json/reverse/?lat=%f&lon=%f&country=us&lang=en&count=1", cacheSize);
+ super(URL + "?lat=%f&lon=%f&country=us&lang=en&count=1", cacheSize);
}
public GeocodeFarmReverseGeocoder(String key, int cacheSize) {
- super("https://www.geocode.farm/v3/json/reverse/?lat=%f&lon=%f&country=us&lang=en&count=1&key=" + key, cacheSize);
+ super(URL + "?lat=%f&lon=%f&country=us&lang=en&count=1&key=" + key, cacheSize);
}
@Override
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index 94ca1fc3c..ade27a56a 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BcdUtil;
-import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 12c9d20b5..ce915fde8 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -271,9 +271,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
} else if (header == 0x7979) {
- int length = buf.readUnsignedShort();
- int dataLength = length - 6;
-
+ buf.readUnsignedShort(); // length
int type = buf.readUnsignedByte();
if (type == MSG_INFO) {
diff --git a/src/org/traccar/protocol/HuaShengFrameDecoder.java b/src/org/traccar/protocol/HuaShengFrameDecoder.java
index 922bc3979..5d68fef9e 100644
--- a/src/org/traccar/protocol/HuaShengFrameDecoder.java
+++ b/src/org/traccar/protocol/HuaShengFrameDecoder.java
@@ -16,7 +16,6 @@
package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
diff --git a/src/org/traccar/protocol/HuaShengProtocol.java b/src/org/traccar/protocol/HuaShengProtocol.java
index 351f886db..53a77c603 100644
--- a/src/org/traccar/protocol/HuaShengProtocol.java
+++ b/src/org/traccar/protocol/HuaShengProtocol.java
@@ -17,7 +17,6 @@ package org.traccar.protocol;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
diff --git a/src/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/org/traccar/protocol/HuaShengProtocolDecoder.java
index 6743db47d..50517045b 100644
--- a/src/org/traccar/protocol/HuaShengProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuaShengProtocolDecoder.java
@@ -19,7 +19,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.helper.*;
+import org.traccar.helper.DateBuilder;
+import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -96,12 +97,12 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
String time = buf.readBytes(12).toString(StandardCharsets.US_ASCII);
DateBuilder dateBuilder = new DateBuilder()
- .setYear(Integer.valueOf(time.substring(0, 2)))
- .setMonth(Integer.valueOf(time.substring(2, 4)))
- .setDay(Integer.valueOf(time.substring(4, 6)))
- .setHour(Integer.valueOf(time.substring(6, 8)))
- .setMinute(Integer.valueOf(time.substring(8, 10)))
- .setSecond(Integer.valueOf(time.substring(10, 12)));
+ .setYear(Integer.parseInt(time.substring(0, 2)))
+ .setMonth(Integer.parseInt(time.substring(2, 4)))
+ .setDay(Integer.parseInt(time.substring(4, 6)))
+ .setHour(Integer.parseInt(time.substring(6, 8)))
+ .setMinute(Integer.parseInt(time.substring(8, 10)))
+ .setSecond(Integer.parseInt(time.substring(10, 12)));
position.setTime(dateBuilder.getDate());
position.setLongitude(buf.readInt() * 0.00001);