Repository: activemq Updated Branches: refs/heads/trunk 67ead201e -> d9d9d5b66
https://issues.apache.org/jira/browse/AMQ-5389 https://issues.apache.org/jira/browse/AMQ-5387 Fixes some issues around processing of back to back frames and reading of null blocks between messages. Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/d9d9d5b6 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/d9d9d5b6 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/d9d9d5b6 Branch: refs/heads/trunk Commit: d9d9d5b666c87bf54d0814471133677daec92aa6 Parents: 6c4f15e Author: Timothy Bish <[email protected]> Authored: Tue Oct 21 17:14:29 2014 -0400 Committer: Timothy Bish <[email protected]> Committed: Tue Oct 21 17:14:47 2014 -0400 ---------------------------------------------------------------------- .../java/org/apache/activemq/transport/mqtt/MQTTCodec.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/d9d9d5b6/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTCodec.java ---------------------------------------------------------------------- diff --git a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTCodec.java b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTCodec.java index 6970af7..5a78fda 100644 --- a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTCodec.java +++ b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTCodec.java @@ -109,8 +109,7 @@ public class MQTTCodec { @Override public void parse(DataByteArrayInputStream data, int readSize) throws IOException { - int i = 0; - while (i++ < readSize) { + while (readSize-- > 0) { byte b = data.readByte(); // skip repeating nulls if (b == 0) { @@ -120,8 +119,8 @@ public class MQTTCodec { header = b; currentParser = initializeVariableLengthParser(); - if (readSize > 1) { - currentParser.parse(data, readSize - 1); + if (readSize > 0) { + currentParser.parse(data, readSize); } return; } @@ -194,7 +193,7 @@ public class MQTTCodec { if (payLoadRead == contentLength) { processCommand(); currentParser = initializeHeaderParser(); - readSize = readSize - payLoadRead; + readSize = readSize - length; if (readSize > 0) { currentParser.parse(data, readSize); }
