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 2018/11/14 16:15:15 UTC

[1/2] ant git commit: Avoid FileInputStream and FileOutputStream.

Repository: ant
Updated Branches:
  refs/heads/master e25053ff4 -> 39e5e40e3


Avoid FileInputStream and FileOutputStream.


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/14af8762
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/14af8762
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/14af8762

Branch: refs/heads/master
Commit: 14af87629d5d7a77cb25d8ffc100fdc76ed7e372
Parents: e25053f
Author: reudismam@gmail.com <re...@gmail.com>
Authored: Sun Nov 4 14:31:37 2018 -0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Nov 14 17:14:28 2018 +0100

----------------------------------------------------------------------
 src/tests/antunit/core/uuencode/src/task/BaseTask.java         | 5 +++--
 src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java   | 5 +++--
 src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java | 5 +++--
 src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java | 5 +++--
 4 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/14af8762/src/tests/antunit/core/uuencode/src/task/BaseTask.java
----------------------------------------------------------------------
diff --git a/src/tests/antunit/core/uuencode/src/task/BaseTask.java b/src/tests/antunit/core/uuencode/src/task/BaseTask.java
index cfb30b1..a54c8b9 100644
--- a/src/tests/antunit/core/uuencode/src/task/BaseTask.java
+++ b/src/tests/antunit/core/uuencode/src/task/BaseTask.java
@@ -26,6 +26,7 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Files;
 
 /**
  * Base class for the uuencode/decode test tasks.
@@ -54,8 +55,8 @@ abstract public class BaseTask extends Task {
         OutputStream outputStream = null;
         try {
             inputStream = new BufferedInputStream(
-                new FileInputStream(getInFile()));
-            outputStream = new FileOutputStream(getOutFile());
+                Files.newInputStream(getInFile().toPath()));
+            outputStream = Files.newOutputStream(getOutFile().toPath());
             doit(inputStream, outputStream);
         } catch (Exception ex) {
             throw new BuildException(ex);

http://git-wip-us.apache.org/repos/asf/ant/blob/14af8762/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java b/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
index 5620afd..cefad94 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
@@ -29,6 +29,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
 
 import static org.hamcrest.Matchers.endsWith;
 import static org.junit.Assert.assertEquals;
@@ -68,12 +69,12 @@ public class BZip2Test {
         File actualFile   = new File(outputDir, "asf-logo-huge.tar.bz2");
 
         InputStream originalIn =
-            new BufferedInputStream(new FileInputStream(originalFile));
+            new BufferedInputStream(Files.newInputStream(originalFile.toPath()));
         assertEquals((byte) 'B', originalIn.read());
         assertEquals((byte) 'Z', originalIn.read());
 
         InputStream actualIn =
-            new BufferedInputStream(new FileInputStream(actualFile));
+            new BufferedInputStream(Files.newInputStream(actualFile.toPath()));
         assertEquals((byte) 'B', actualIn.read());
         assertEquals((byte) 'Z', actualIn.read());
 

http://git-wip-us.apache.org/repos/asf/ant/blob/14af8762/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
index a34b9f4..a799e8b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
 
 import junit.framework.AssertionFailedError;
 
@@ -234,8 +235,8 @@ public class FixCrLfTest {
     public void assertEqualContent(File expect, File result) throws AssertionFailedError, IOException {
         assertTrue("Expected file " + result + " doesn\'t exist", result.exists());
 
-        try (InputStream inExpect = new BufferedInputStream(new FileInputStream(expect));
-             InputStream inResult = new BufferedInputStream(new FileInputStream(result))) {
+        try (InputStream inExpect = new BufferedInputStream(Files.newInputStream(expect.toPath()));
+             InputStream inResult = new BufferedInputStream(Files.newInputStream(result.toPath()))) {
 
             int expectedByte = inExpect.read();
             while (expectedByte != -1) {

http://git-wip-us.apache.org/repos/asf/ant/blob/14af8762/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
index 6045f85..909091a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
@@ -144,8 +145,8 @@ public class ReplaceTest {
     public void assertEqualContent(File expect, File result) throws IOException {
         assertTrue("Expected file " + result + " doesn't exist", result.exists());
 
-        try (InputStream inExpect = new BufferedInputStream(new FileInputStream(expect));
-             InputStream inResult = new BufferedInputStream(new FileInputStream(result))) {
+        try (InputStream inExpect = new BufferedInputStream(Files.newInputStream(expect.toPath()));
+             InputStream inResult = new BufferedInputStream(Files.newInputStream(result.toPath()))) {
             int expectedByte = inExpect.read();
             while (expectedByte != -1) {
                 assertEquals(expectedByte, inResult.read());


[2/2] ant git commit: closes #77

Posted by bo...@apache.org.
closes #77


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/39e5e40e
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/39e5e40e
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/39e5e40e

Branch: refs/heads/master
Commit: 39e5e40e3901821fac72718c6afd4e77c1cdfbac
Parents: 14af876
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Nov 14 17:14:57 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Nov 14 17:14:57 2018 +0100

----------------------------------------------------------------------

----------------------------------------------------------------------