Author: clebert.suconic(a)jboss.com
Date: 2011-03-21 23:47:43 -0400 (Mon, 21 Mar 2011)
New Revision: 10350
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompDecoder.java
Log:
https://issues.jboss.org/browse/HORNETQ-658 - Tweak on decoder
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompDecoder.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompDecoder.java 2011-03-21
17:36:06 UTC (rev 10349)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompDecoder.java 2011-03-22
03:47:43 UTC (rev 10350)
@@ -421,7 +421,7 @@
if (contentLength != -1)
{
- if (pos + contentLength > data)
+ if (pos + contentLength + 1 > data)
{
// Need more bytes
}
@@ -462,9 +462,11 @@
{
if (data > pos)
{
- // More data still in the buffer from the next packet
+ if (workingBuffer[pos] == NEW_LINE) pos++;
- System.arraycopy(workingBuffer, pos, workingBuffer, 0, data - pos);
+ if (data > pos)
+ // More data still in the buffer from the next packet
+ System.arraycopy(workingBuffer, pos, workingBuffer, 0, data - pos);
}
data = data - pos;