diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java | 7 | ||||
-rw-r--r-- | java/common/src/org/apache/qpid/framing/EncodingUtils.java | 13 |
2 files changed, 15 insertions, 5 deletions
diff --git a/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java b/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java index 20eafa0be7..859fdac489 100644 --- a/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java +++ b/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java @@ -218,8 +218,7 @@ public class BasicContentHeaderProperties implements ContentHeaderProperties } if ((_propertyFlags & (1 << 6)) > 0) { - EncodingUtils.writeUnsignedInteger(buffer, 0/*timestamp msb*/); - EncodingUtils.writeUnsignedInteger(buffer, _timestamp); + EncodingUtils.writeTimestamp(buffer, _timestamp); } if ((_propertyFlags & (1 << 5)) > 0) { @@ -301,9 +300,7 @@ public class BasicContentHeaderProperties implements ContentHeaderProperties } if ((_propertyFlags & (1 << 6)) > 0) { - // Discard msb from AMQ timestamp - buffer.getUnsignedInt(); - _timestamp = buffer.getUnsignedInt(); + _timestamp = EncodingUtils.readTimestamp(buffer); } if ((_propertyFlags & (1 << 5)) > 0) { diff --git a/java/common/src/org/apache/qpid/framing/EncodingUtils.java b/java/common/src/org/apache/qpid/framing/EncodingUtils.java index f2f7a3b7a2..5b35044b25 100644 --- a/java/common/src/org/apache/qpid/framing/EncodingUtils.java +++ b/java/common/src/org/apache/qpid/framing/EncodingUtils.java @@ -255,6 +255,12 @@ public class EncodingUtils writeUnsignedInteger(buffer, 0); } } + + public static void writeTimestamp(ByteBuffer buffer, long timestamp) + { + writeUnsignedInteger(buffer, 0/*timestamp msb*/); + writeUnsignedInteger(buffer, timestamp); + } public static boolean[] readBooleans(ByteBuffer buffer) { @@ -346,6 +352,13 @@ public class EncodingUtils return result; } } + + public static long readTimestamp(ByteBuffer buffer) + { + // Discard msb from AMQ timestamp + buffer.getUnsignedInt(); + return buffer.getUnsignedInt(); + } // Will barf with a NPE on a null input. Not sure whether it should return null or // an empty field-table (which would be slower - perhaps unnecessarily). |