Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public String toString() {
Field f = this.schema.get(i);
b.append(f.name);
b.append('=');
if (f.type() instanceof ArrayOf) {
if (f.type() instanceof ArrayOf && this.values[i] != null) {
Object[] arrayValue = (Object[]) this.values[i];
b.append('[');
for (int j = 0; j < arrayValue.length; j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import java.nio.ByteBuffer;
Expand Down Expand Up @@ -231,6 +232,13 @@ public void testReadNegativeBytesSize() {
}
}

@Test
public void testToString() {
String structStr = this.struct.toString();
assertNotNull("Struct string should not be null.", structStr);
assertFalse("Struct string should not be empty.", structStr.isEmpty());
}

private Object roundtrip(Type type, Object obj) {
ByteBuffer buffer = ByteBuffer.allocate(type.sizeOf(obj));
type.write(buffer, obj);
Expand Down