Deserialising StringBuilder[] produces array with null elements.
Steps to Reproduce
package org.example;
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.wire.BinaryWire;
import net.openhft.chronicle.wire.SelfDescribingMarshallable;
public class Main {
public static void main(String[] args) {
var bytes = Bytes.allocateElasticOnHeap();
var wire = new BinaryWire(bytes);
var foo1 = new Foo();
foo1.bar = new StringBuilder[] { new StringBuilder("baz") };
wire.write("data").object(foo1);
var foo2 = wire.read("data").object(Foo.class);
System.out.println(foo2.bar[0]);
}
public static class Foo extends SelfDescribingMarshallable {
StringBuilder[] bar;
}
}
Deserialising
StringBuilder[]
produces array with null elements.Steps to Reproduce
Expected Output
baz
Current Output
null
Likely Bug Location
https://github.com/OpenHFT/Chronicle-Wire/blob/ea/src/main/java/net/openhft/chronicle/wire/Wires.java#L1504-L1513
Here, when
o
is null,builder
fromstlSb.get()
is updated and closed instead of creating a newStringBuilder
object.