From daced04729f503e3ad165926b41af2cbcdb53b13 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Wed, 18 Jan 2023 12:23:44 +0000 Subject: check complete span node type * this matches actual serialization format and C++ implementation --- .../document/serialization/VespaDocumentDeserializer6.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'document') diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java index 6ab0698e0bd..a9c3d4804a1 100644 --- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java +++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java @@ -587,19 +587,19 @@ public class VespaDocumentDeserializer6 extends BufferSerializer implements Docu buf.position(buf.position() - 1); SpanNode retval; - if ((type & Span.ID) == Span.ID) { + if (type == Span.ID) { retval = new Span(); if (spanNodes != null) { spanNodes.add(retval); } read((Span) retval); - } else if ((type & SpanList.ID) == SpanList.ID) { + } else if (type == SpanList.ID) { retval = new SpanList(); if (spanNodes != null) { spanNodes.add(retval); } read((SpanList) retval); - } else if ((type & AlternateSpanList.ID) == AlternateSpanList.ID) { + } else if (type == AlternateSpanList.ID) { retval = new AlternateSpanList(); if (spanNodes != null) { spanNodes.add(retval); @@ -706,7 +706,7 @@ public class VespaDocumentDeserializer6 extends BufferSerializer implements Docu public void read(Span span) { byte type = buf.get(); - if ((type & Span.ID) != Span.ID) { + if (type != Span.ID) { throw new DeserializationException("Cannot deserialize Span with type " + type); } span.setFrom(buf.getInt1_2_4Bytes()); @@ -727,7 +727,7 @@ public class VespaDocumentDeserializer6 extends BufferSerializer implements Docu public void read(SpanList spanList) { byte type = buf.get(); - if ((type & SpanList.ID) != SpanList.ID) { + if (type != SpanList.ID) { throw new DeserializationException("Cannot deserialize SpanList with type " + type); } List nodes = readSpanList(); @@ -738,7 +738,7 @@ public class VespaDocumentDeserializer6 extends BufferSerializer implements Docu public void read(AlternateSpanList altSpanList) { byte type = buf.get(); - if ((type & AlternateSpanList.ID) != AlternateSpanList.ID) { + if (type != AlternateSpanList.ID) { throw new DeserializationException("Cannot deserialize AlternateSpanList with type " + type); } int numSubTrees = buf.getInt1_2_4Bytes(); -- cgit v1.2.3