cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1066099 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
Date Tue, 01 Feb 2011 17:45:42 GMT
Author: jbellis
Date: Tue Feb  1 17:45:42 2011
New Revision: 1066099

URL: http://svn.apache.org/viewvc?rev=1066099&view=rev
Log:
replace isDirect with !hasArray for correctness

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java?rev=1066099&r1=1066098&r2=1066099&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
Tue Feb  1 17:45:42 2011
@@ -209,17 +209,15 @@ public class ByteBufferUtil
           
         ByteBuffer clone = ByteBuffer.allocate(o.remaining());
 
-        if (o.isDirect())
+        if (o.hasArray())
         {
-            for (int i = o.position(); i < o.limit(); i++)
-            {
-                clone.put(o.get(i));
-            }
-            clone.flip();
+            System.arraycopy(o.array(), o.arrayOffset() + o.position(), clone.array(), 0,
o.remaining());
         }
         else
         {
-            System.arraycopy(o.array(), o.arrayOffset() + o.position(), clone.array(), 0,
o.remaining());
+            for (int i = o.position(); i < o.limit(); i++)
+                clone.put(o.get(i));
+            clone.flip();
         }
 
         return clone;



Mime
View raw message