This is an automated email from the ASF dual-hosted git repository.
jorgebg pushed a commit to branch TINKERPOP-1942
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/TINKERPOP-1942 by this push:
new 341db8a Fix sample custom type serializer
341db8a is described below
commit 341db8acf1a8e340165ae687331a7b01805795cc
Author: Jorge Bay Gondra <[email protected]>
AuthorDate: Tue Dec 18 15:41:35 2018 +0100
Fix sample custom type serializer
---
.../driver/ser/binary/types/sample/SamplePersonSerializer.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
index 0da7902..c5c6633 100644
---
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
+++
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializer.java
@@ -49,7 +49,9 @@ class SamplePersonSerializer implements
CustomTypeSerializer<SamplePerson> {
public SamplePerson read(final ByteBuf buffer, final GraphBinaryReader
context) throws SerializationException {
// {custom type info}, {value_flag} and {value}
// No custom_type_info
- assert buffer.readInt() == 0;
+ if (buffer.readInt() != 0) {
+ throw new SerializationException("{custom_type_info} should not be
provided for this custom type");
+ }
final byte valueFlag = buffer.readByte();
if ((valueFlag & 1) == 1) {
@@ -59,8 +61,10 @@ class SamplePersonSerializer implements
CustomTypeSerializer<SamplePerson> {
// Read the buffer int, no necessary in this case
buffer.readInt();
- return new SamplePerson(
- context.readValue(buffer, String.class, false),
context.readValue(buffer, Date.class,false));
+ final String name = context.readValue(buffer, String.class, false);
+ final Date birthDate = context.readValue(buffer, Date.class, false);
+
+ return new SamplePerson(name, birthDate);
}
@Override