aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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());