aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-28 14:35:02 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-28 14:35:02 +1200
commitb1e7bd492b9f6739936e533b4ab16d4825f1ce3c (patch)
tree405db9621d0d7e0fabcc82ee906a03837186c03a
parent457bda5a0e8501dfae1d3dd4e0d39f778ee4d9da (diff)
downloadtraccar-server-b1e7bd492b9f6739936e533b4ab16d4825f1ce3c.tar.gz
traccar-server-b1e7bd492b9f6739936e533b4ab16d4825f1ce3c.tar.bz2
traccar-server-b1e7bd492b9f6739936e533b4ab16d4825f1ce3c.zip
Fix saving original raw binary data
-rw-r--r--debug.xml2
-rw-r--r--src/org/traccar/ExtendedObjectDecoder.java3
2 files changed, 3 insertions, 2 deletions
diff --git a/debug.xml b/debug.xml
index f078a7e9d..fab27920e 100644
--- a/debug.xml
+++ b/debug.xml
@@ -80,7 +80,7 @@
<entry key='database.ignoreUnknown'>true</entry>
<entry key='database.xml'>false</entry>
- <entry key='database.saveOriginal'>false</entry>
+ <entry key='database.saveOriginal'>true</entry>
<entry key='database.changelog'>./schema/changelog-master.xml</entry>
diff --git a/src/org/traccar/ExtendedObjectDecoder.java b/src/org/traccar/ExtendedObjectDecoder.java
index d7ca30de4..1cfc93541 100644
--- a/src/org/traccar/ExtendedObjectDecoder.java
+++ b/src/org/traccar/ExtendedObjectDecoder.java
@@ -36,7 +36,8 @@ public abstract class ExtendedObjectDecoder implements ChannelUpstreamHandler {
if (Context.getConfig().getBoolean("database.saveOriginal") && decodedMessage instanceof Position) {
Position position = (Position) decodedMessage;
if (originalMessage instanceof ChannelBuffer) {
- position.set(Position.KEY_ORIGINAL, ChannelBuffers.hexDump((ChannelBuffer) originalMessage));
+ ChannelBuffer buf = (ChannelBuffer) originalMessage;
+ position.set(Position.KEY_ORIGINAL, ChannelBuffers.hexDump(buf, 0, buf.writerIndex()));
} else if (originalMessage instanceof String) {
position.set(Position.KEY_ORIGINAL, DatatypeConverter.printHexBinary(
((String) originalMessage).getBytes(StandardCharsets.US_ASCII)));