ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [4/4] ant git commit: close streams to make files deletable on windows
Date Sat, 09 Dec 2017 21:13:22 GMT
close streams to make files deletable on windows


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

Branch: refs/heads/1.9.x
Commit: 608b65a3e3663c63c63032d058b1c4a4498ed93c
Parents: ca1ed22
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Dec 9 22:04:30 2017 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Dec 9 22:04:30 2017 +0100

----------------------------------------------------------------------
 .../taskdefs/optional/i18n/TranslateTest.java   | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/608b65a3/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
index e58e5ce..15564a7 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
@@ -71,16 +71,24 @@ public class TranslateTest {
 
         @SuppressWarnings("resource")
         FileInputStream fis1 = new FileInputStream(file1);
-        @SuppressWarnings("resource")
-        FileInputStream fis2 = new FileInputStream(file2);
-        int read = 0;
-        while ((read = fis1.read(buffer1)) != -1) {
-            fis2.read(buffer2);
-            for (int i = 0; i < read; ++i) {
-                if (buffer1[i] != buffer2[i]) {
-                    return false;
+        try {
+            @SuppressWarnings("resource")
+            FileInputStream fis2 = new FileInputStream(file2);
+            try {
+                int read = 0;
+                while ((read = fis1.read(buffer1)) != -1) {
+                    fis2.read(buffer2);
+                    for (int i = 0; i < read; ++i) {
+                        if (buffer1[i] != buffer2[i]) {
+                            return false;
+                        }
+                    }
                 }
+            } finally {
+                fis2.close();
             }
+        } finally {
+            fis1.close();
         }
         return true;
     }


Mime
View raw message