There seems to be some cases where JSONWire adds NULL byte(s) to the JSON representation. So far I have only seen this when settinguse8bit to true. Here is a minimal example that shows that behavior:
@Test
void example() {
final Bytes<byte[]> bytes = Bytes.allocateElasticOnHeap(1024);
final JSONWire wire = new JSONWire(bytes, true);
final Foo foo = new Foo();
wire.getValueOut().marshallable(foo);
System.out.println(bytes.toHexString());
}
private static class Foo extends SelfDescribingMarshallable {
final Bar a = new Bar();
private static class Bar extends SelfDescribingMarshallable {
String b = "c";
}
}
The output is below and contains a NULL byte before the closing "}":
There seems to be some cases where JSONWire adds NULL byte(s) to the JSON representation. So far I have only seen this when setting
use8bit
to true. Here is a minimal example that shows that behavior:The output is below and contains a NULL byte before the closing "}":
This bit of code in ByteStringAppender looks suspicious:
start
andend
are being passed towrite
which expects an offset and length:default S write(@NotNull BytesStore bytes, long offset, long length)
.