Repository: ant
Updated Branches:
  refs/heads/master c8b7af521 -> 81882fe74


Java8 refactoring introdiced PrintWriter that we do not want to use

PrintWriter's `println` method swallows exceptions and we really want
to know when writing fails.


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

Branch: refs/heads/master
Commit: 81882fe7435a245293fe377b6c6224400519d603
Parents: c8b7af5
Author: Stefan Bodewig <bode...@apache.org>
Authored: Mon Feb 12 10:18:54 2018 +0100
Committer: Stefan Bodewig <bode...@apache.org>
Committed: Mon Feb 12 10:18:54 2018 +0100

----------------------------------------------------------------------
 .../org/apache/tools/ant/taskdefs/optional/Cab.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/81882fe7/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java 
b/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
index b94387d..ebc46e2 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
@@ -23,7 +23,6 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.PrintWriter;
 import java.util.Collections;
 import java.util.Vector;
 
@@ -178,10 +177,13 @@ public class Cab extends MatchingTask {
         throws IOException {
         File listFile = FILE_UTILS.createTempFile("ant", "", null, true, true);
 
-        try (PrintWriter writer =
-            new PrintWriter(new BufferedWriter(new FileWriter(listFile)))) {
-            files.stream().map(f -> String.format("\"%s\"", f))
-                .forEach(writer::println);
+        try (BufferedWriter writer =
+            new BufferedWriter(new FileWriter(listFile))) {
+            for (String f : files) {
+                String s = String.format("\"%s\"", f);
+                writer.write(s);
+                writer.newLine();
+            }
         }
         return listFile;
     }

Reply via email to