Require exact binary length
This commit is contained in:
parent
26961125c0
commit
dc03d25fdc
@ -65,7 +65,7 @@ public interface SerializerFixedBinaryLength<A> extends Serializer<A> {
|
|||||||
var bytes = deserialized.getBytes(StandardCharsets.UTF_8);
|
var bytes = deserialized.getBytes(StandardCharsets.UTF_8);
|
||||||
out.ensureWritable(bytes.length);
|
out.ensureWritable(bytes.length);
|
||||||
out.write(bytes);
|
out.write(bytes);
|
||||||
if (bytes.length < getSerializedBinaryLength()) {
|
if (bytes.length != getSerializedBinaryLength()) {
|
||||||
throw new SerializationException("Fixed serializer with " + getSerializedBinaryLength()
|
throw new SerializationException("Fixed serializer with " + getSerializedBinaryLength()
|
||||||
+ " bytes has tried to serialize an element with "
|
+ " bytes has tried to serialize an element with "
|
||||||
+ bytes.length + " bytes instead");
|
+ bytes.length + " bytes instead");
|
||||||
|
Loading…
Reference in New Issue
Block a user