From b1e7bd492b9f6739936e533b4ab16d4825f1ce3c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 28 Jul 2016 14:35:02 +1200 Subject: Fix saving original raw binary data --- src/org/traccar/ExtendedObjectDecoder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') 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))); -- cgit v1.2.3