Skip to content

Commit

Permalink
Don't write footer when record is empty (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
dr0i committed Sep 30, 2024
1 parent edb3a8d commit 04525d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ protected void onResetStream() {

@Override
protected void onCloseStream() {
writeFooter();
if (!atStreamStart) {
writeFooter();
}
sendAndClearData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,11 @@ public void shouldNotEncodeNestedTypeLiteralAsAttribute() {
assertEquals(expected, actual);
}

@Test
public void issue543_shouldNotWriteFooterWhenRecordIsEmpty() {
encoder.closeStream();
String actual = resultCollector.toString();
assertTrue(actual.isEmpty());
}

}

0 comments on commit 04525d9

Please sign in to comment.