Browse Source

avoid FileOutputStream constructor

master
Stefan Bodewig 5 years ago
parent
commit
1ce1cc2317
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java

+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java View File

@@ -27,10 +27,10 @@ import org.junit.platform.launcher.TestPlan;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.Closeable; import java.io.Closeable;
import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader; import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import java.nio.BufferOverflowException; import java.nio.BufferOverflowException;
@@ -217,7 +217,7 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter {
private ByteBuffer inMemoryStore = ByteBuffer.allocate(DEFAULT_CAPACITY_IN_BYTES); private ByteBuffer inMemoryStore = ByteBuffer.allocate(DEFAULT_CAPACITY_IN_BYTES);
private boolean usingFileStore = false; private boolean usingFileStore = false;
private Path filePath; private Path filePath;
private FileOutputStream fileOutputStream;
private OutputStream fileOutputStream;


private SysOutErrContentStore(final TestExecutionContext context, final boolean isSysOut) { private SysOutErrContentStore(final TestExecutionContext context, final boolean isSysOut) {
this.context = context; this.context = context;
@@ -261,11 +261,11 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter {
this.fileOutputStream.write(data, offset, length); this.fileOutputStream.write(data, offset, length);
} }


private FileOutputStream createFileStore() throws IOException {
private OutputStream createFileStore() throws IOException {
this.filePath = FileUtils.getFileUtils() this.filePath = FileUtils.getFileUtils()
.createTempFile(context.getProject().orElse(null), null, this.tmpFileSuffix, null, true, true) .createTempFile(context.getProject().orElse(null), null, this.tmpFileSuffix, null, true, true)
.toPath(); .toPath();
return new FileOutputStream(this.filePath.toFile());
return Files.newOutputStream(this.filePath);
} }


/* /*


Loading…
Cancel
Save