tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject [31/50] tinkerpop git commit: Fixed minor bug in ByteBuffer gryo serializer. CTR
Date Mon, 09 Jan 2017 14:58:52 GMT
Fixed minor bug in ByteBuffer gryo serializer. CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/fabc4b37
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/fabc4b37
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/fabc4b37

Branch: refs/heads/TINKERPOP-1545-tp32
Commit: fabc4b37c3fceb427af4328e11aaf411f265d1ef
Parents: 26ffb9a
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue Dec 27 10:36:38 2016 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue Dec 27 10:36:38 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/io/gryo/UtilSerializers.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fabc4b37/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UtilSerializers.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UtilSerializers.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UtilSerializers.java
index c7095d6..7004b9f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UtilSerializers.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UtilSerializers.java
@@ -34,6 +34,7 @@ import java.net.URI;
 import java.nio.ByteBuffer;
 import java.util.AbstractMap;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -65,8 +66,9 @@ final class UtilSerializers {
     public final static class ByteBufferSerializer implements SerializerShim<ByteBuffer>
{
         @Override
         public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final
O output, final ByteBuffer bb) {
-            final byte[] b = new byte[bb.remaining()];
-            bb.get(b);
+            final byte[] b = bb.array();
+            final int arrayOffset = bb.arrayOffset();
+            Arrays.copyOfRange(b, arrayOffset + bb.position(), arrayOffset + bb.limit());
             output.writeInt(b.length);
             output.writeBytes(b, 0, b.length);
         }


Mime
View raw message