aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-08 14:33:25 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-07-08 14:33:25 +1200
commit731020440991a53034dd2e980add2a08cb9a19de (patch)
tree2fdc5564eea69f3b3bdffb17439519daf505b348 /src
parentdc5dc6b6ff9b33db50d7a706017b4a0e8f423398 (diff)
downloadtrackermap-server-731020440991a53034dd2e980add2a08cb9a19de.tar.gz
trackermap-server-731020440991a53034dd2e980add2a08cb9a19de.tar.bz2
trackermap-server-731020440991a53034dd2e980add2a08cb9a19de.zip
Fix code check issues
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/GeocoderHandler.java11
-rw-r--r--src/org/traccar/database/MediaManager.java5
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java2
3 files changed, 10 insertions, 8 deletions
diff --git a/src/org/traccar/GeocoderHandler.java b/src/org/traccar/GeocoderHandler.java
index 2742ff1a7..a211d1a23 100644
--- a/src/org/traccar/GeocoderHandler.java
+++ b/src/org/traccar/GeocoderHandler.java
@@ -60,12 +60,11 @@ public class GeocoderHandler implements ChannelUpstreamHandler {
if (processInvalidPositions || position.getValid()) {
if (geocoderReuseDistance != 0) {
Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
- if (lastPosition != null && lastPosition.getAddress() != null) {
- if (position.getDouble(Position.KEY_DISTANCE) <= geocoderReuseDistance) {
- position.setAddress(lastPosition.getAddress());
- Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
- return;
- }
+ if (lastPosition != null && lastPosition.getAddress() != null
+ && position.getDouble(Position.KEY_DISTANCE) <= geocoderReuseDistance) {
+ position.setAddress(lastPosition.getAddress());
+ Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
+ return;
}
}
diff --git a/src/org/traccar/database/MediaManager.java b/src/org/traccar/database/MediaManager.java
index 4b5930642..2c448a20c 100644
--- a/src/org/traccar/database/MediaManager.java
+++ b/src/org/traccar/database/MediaManager.java
@@ -40,7 +40,10 @@ public class MediaManager {
private File createFile(String uniqueId, String name) throws IOException {
Path filePath = Paths.get(path, uniqueId, name);
- Files.createDirectories(filePath.getParent());
+ Path directoryPath = filePath.getParent();
+ if (directoryPath != null) {
+ Files.createDirectories(directoryPath);
+ }
return filePath.toFile();
}
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index 8a6f49ef0..b39e3eab1 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -88,7 +88,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
position.set("gpsAntennaStatus", buf.readUnsignedShort());
position.setSpeed(buf.readUnsignedShort() * 0.194384);
- position.setCourse((double) buf.readUnsignedShort());
+ position.setCourse(buf.readUnsignedShort());
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());