You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2020/06/03 09:08:44 UTC
[ant] branch master updated: avoid FileOutputStream constructor
This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 1ce1cc2 avoid FileOutputStream constructor
1ce1cc2 is described below
commit 1ce1cc2317cb2b2773ab6b765f1a79ccd4806926
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Wed Jun 3 11:08:19 2020 +0200
avoid FileOutputStream constructor
---
.../optional/junitlauncher/AbstractJUnitResultFormatter.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
index 22a11e0..be70e94 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
@@ -27,10 +27,10 @@ import org.junit.platform.launcher.TestPlan;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
-import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.nio.BufferOverflowException;
@@ -217,7 +217,7 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter {
private ByteBuffer inMemoryStore = ByteBuffer.allocate(DEFAULT_CAPACITY_IN_BYTES);
private boolean usingFileStore = false;
private Path filePath;
- private FileOutputStream fileOutputStream;
+ private OutputStream fileOutputStream;
private SysOutErrContentStore(final TestExecutionContext context, final boolean isSysOut) {
this.context = context;
@@ -261,11 +261,11 @@ abstract class AbstractJUnitResultFormatter implements TestResultFormatter {
this.fileOutputStream.write(data, offset, length);
}
- private FileOutputStream createFileStore() throws IOException {
+ private OutputStream createFileStore() throws IOException {
this.filePath = FileUtils.getFileUtils()
.createTempFile(context.getProject().orElse(null), null, this.tmpFileSuffix, null, true, true)
.toPath();
- return new FileOutputStream(this.filePath.toFile());
+ return Files.newOutputStream(this.filePath);
}
/*