aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ExtendedObjectDecoder.java
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/org/traccar/ExtendedObjectDecoder.java
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/org/traccar/ExtendedObjectDecoder.java')
-rw-r--r--src/org/traccar/ExtendedObjectDecoder.java18
1 files changed, 8 insertions, 10 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())));
}
}
}