Skip to content

Commit

Permalink
fix: updated report generation to use temp files with random names
Browse files Browse the repository at this point in the history
  • Loading branch information
YamStranger committed Feb 29, 2016
1 parent 5afea72 commit fa25694
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -52,7 +52,7 @@ public void generateReportsFor(TestOutcomes testOutcomes) throws IOException {
File temporary = new File(getOutputDirectory(), reportFilename.concat(unique));
LOGGER.debug("GENERATING JUNIT REPORT {} using temporary file {}", reportFilename, temporary);

try(OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(report))){
try(OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(temporary))){
junitXMLConverter.write(testCase, testCaseOutcomes, outputStream);
outputStream.flush();
Files.move(temporary.toPath(), report.toPath(), StandardCopyOption.REPLACE_EXISTING);
Expand Down
Expand Up @@ -79,7 +79,7 @@ public File generateReportFor(final TestOutcome testOutcome, final TestOutcomes
LOGGER.debug("Generating XML report for {} to file {} (using temp file {})", testOutcome.getTitle(), report.getAbsolutePath(), temporary.getAbsolutePath());

try(
OutputStream outputStream = new FileOutputStream(report);
OutputStream outputStream = new FileOutputStream(temporary);
OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)) {
xstream.toXML(storedTestOutcome, writer);
writer.flush();
Expand Down

0 comments on commit fa25694

Please sign in to comment.