aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-22 10:17:04 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-22 10:17:04 +1300
commit22d3d0b95866dd273a5c4537d727758e8a1ddd15 (patch)
tree1135c1e5db0bcd2e2424320266e846c3f9704363 /src
parentf0d21710b5a59226fe2f45a989d8134d9cae996a (diff)
downloadtrackermap-server-22d3d0b95866dd273a5c4537d727758e8a1ddd15.tar.gz
trackermap-server-22d3d0b95866dd273a5c4537d727758e8a1ddd15.tar.bz2
trackermap-server-22d3d0b95866dd273a5c4537d727758e8a1ddd15.zip
Fix minor issues in the code
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/ExtendedObjectDecoder.java18
-rw-r--r--src/org/traccar/LocationProviderHandler.java2
-rw-r--r--src/org/traccar/ServerManager.java5
3 files changed, 10 insertions, 15 deletions
diff --git a/src/org/traccar/ExtendedObjectDecoder.java b/src/org/traccar/ExtendedObjectDecoder.java
index 900b7bdbc..329490d29 100644
--- a/src/org/traccar/ExtendedObjectDecoder.java
+++ b/src/org/traccar/ExtendedObjectDecoder.java
@@ -16,6 +16,7 @@
package org.traccar;
import java.net.SocketAddress;
+import java.nio.charset.Charset;
import java.util.Collection;
import org.jboss.netty.buffer.ChannelBuffer;
@@ -34,16 +35,13 @@ import javax.xml.bind.DatatypeConverter;
public abstract class ExtendedObjectDecoder implements ChannelUpstreamHandler {
private void saveOriginal(Object decodedMessage, Object originalMessage) {
- if (Context.getConfig().getBoolean("database.saveOriginal")) {
- if (decodedMessage instanceof Position) {
- Position position = (Position) decodedMessage;
- if (originalMessage instanceof ChannelBuffer) {
- position.set(Event.KEY_ORIGINAL,
- ChannelBuffers.hexDump((ChannelBuffer) originalMessage));
- } else if (originalMessage instanceof String) {
- position.set(Event.KEY_ORIGINAL,
- DatatypeConverter.printHexBinary(((String) originalMessage).getBytes()));
- }
+ if (Context.getConfig().getBoolean("database.saveOriginal") && decodedMessage instanceof Position) {
+ Position position = (Position) decodedMessage;
+ if (originalMessage instanceof ChannelBuffer) {
+ position.set(Event.KEY_ORIGINAL, ChannelBuffers.hexDump((ChannelBuffer) originalMessage));
+ } else if (originalMessage instanceof String) {
+ position.set(Event.KEY_ORIGINAL, DatatypeConverter.printHexBinary(
+ ((String) originalMessage).getBytes(Charset.defaultCharset())));
}
}
}
diff --git a/src/org/traccar/LocationProviderHandler.java b/src/org/traccar/LocationProviderHandler.java
index c59427474..3c0fcf522 100644
--- a/src/org/traccar/LocationProviderHandler.java
+++ b/src/org/traccar/LocationProviderHandler.java
@@ -45,7 +45,7 @@ public class LocationProviderHandler implements ChannelUpstreamHandler {
Object message = e.getMessage();
if (message instanceof Position) {
final Position position = (Position) message;
- if (position.getOutdated() || (processInvalidPositions && !position.getValid())) {
+ if (position.getOutdated() || processInvalidPositions && !position.getValid()) {
locationProvider.getLocation(position.getAttributes(), new LocationProvider.LocationProviderCallback() {
@Override
public void onSuccess(double latitude, double longitude) {
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 2fa44831f..cd6a071db 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,9 +25,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
-import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.channel.ChannelPipeline;
public class ServerManager {