Skip to content

Commit

Permalink
Ensure the XMLStreamWriter is closed after use
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Stein <sormuras@gmail.com>
  • Loading branch information
marcphilipp and sormuras committed Dec 11, 2024
1 parent dab4e51 commit 6a4cb06
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ private boolean shouldInclude(TestPlan testPlan, TestIdentifier testIdentifier)
private void writeXmlReport(TestIdentifier testIdentifier, Map<TestIdentifier, AggregatedTestResult> tests,
Writer out) throws XMLStreamException {

new XmlReport(out).write(testIdentifier, tests);
try (XmlReport report = new XmlReport(out)) {
report.write(testIdentifier, tests);
}
}

class XmlReport implements AutoCloseable {
private class XmlReport implements AutoCloseable {

private final XMLStreamWriter xml;
private final ReplacingWriter out;
Expand Down

0 comments on commit 6a4cb06

Please sign in to comment.