Skip to content

Commit

Permalink
Merge branch '7.0.x' into 7.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rayokota committed Jun 30, 2023
2 parents 1499fed + a73e371 commit 49f93a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ public void testDeserializeRecordWithKeyAndValueAndPrintingKeyAndSchemaIds()
PrintStream ps = new PrintStream(baos);
formatter.writeTo(recordWithKeyAndValue, ps);
assertEquals("\"" + KEY_STRING + "\"\t2\t\"" + A_STRING + "\"\t1\n", baos.toString());

baos = new ByteArrayOutputStream();
ps = new PrintStream(baos);
formatter.writeTo(recordWithValue, ps);
assertEquals("null\tnull\t\"" + A_STRING + "\"\t1\n", baos.toString());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ public void writeTo(ConsumerRecord<byte[], byte[]> consumerRecord, PrintStream o
}
if (printKeyId) {
output.write(idSeparator);
int schemaId = schemaIdFor(consumerRecord.key());
output.print(schemaId);
if (consumerRecord.key() != null) {
int schemaId = schemaIdFor(consumerRecord.key());
output.print(schemaId);
} else {
output.write(NULL_BYTES);
}
}
output.write(keySeparator);
} catch (IOException ioe) {
Expand Down

0 comments on commit 49f93a4

Please sign in to comment.