You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/05/23 17:37:34 UTC

svn commit: r947431 - /activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/Buffer.java

Author: chirino
Date: Sun May 23 15:37:33 2010
New Revision: 947431

URL: http://svn.apache.org/viewvc?rev=947431&view=rev
Log:
Buffer.toString returned a unexpected result when the buffer offset was not zero

Modified:
    activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/Buffer.java

Modified: activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/Buffer.java
URL: http://svn.apache.org/viewvc/activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/Buffer.java?rev=947431&r1=947430&r2=947431&view=diff
==============================================================================
--- activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/Buffer.java (original)
+++ activemq/activemq-protobuf/trunk/activemq-protobuf/src/main/java/org/apache/activemq/protobuf/Buffer.java Sun May 23 15:37:33 2010
@@ -80,9 +80,12 @@ public class Buffer implements Comparabl
     }
 
     final public byte[] toByteArray() {
+        byte[] data = this.data;
+        int length = this.length;
         if (length != data.length) {
             byte t[] = new byte[length];
             System.arraycopy(data, offset, t, 0, length);
+            data = t;
         }
         return data;
     }