[hornetq-commits] JBoss hornetq SVN: r8694 - trunk/src/main/org/hornetq/core/message/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Dec 15 10:09:02 EST 2009


Author: ataylor
Date: 2009-12-15 10:09:02 -0500 (Tue, 15 Dec 2009)
New Revision: 8694

Modified:
   trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
Log:
buffer fix

Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java	2009-12-14 19:31:42 UTC (rev 8693)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java	2009-12-15 15:09:02 UTC (rev 8694)
@@ -838,8 +838,17 @@
          // write it
          buffer.setInt(PacketImpl.PACKET_HEADERS_SIZE, endOfBodyPosition);
 
-         // Position at end of body and skip past the message end position int
-         buffer.setIndex(0, endOfBodyPosition + DataConstants.SIZE_INT);
+         // Position at end of body and skip past the message end position int.
+         // check for enough room in the buffer even tho it is dynamic
+         if((endOfBodyPosition + 4) > buffer.capacity())
+         {
+            buffer.setIndex(0, endOfBodyPosition);
+            buffer.writeInt(0);
+         }
+         else
+         {
+            buffer.setIndex(0, endOfBodyPosition + DataConstants.SIZE_INT);
+         }
 
          encodeHeadersAndProperties(buffer);
 



More information about the hornetq-commits mailing list