Browse Source

ZOOKEEPER-1596. Zab1_0Test should ensure that the file is closed (Enis Soztutar via phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1420028 13f79535-47bb-0310-9956-ffa450edef68
Patrick D. Hunt 12 years ago
parent
commit
8052a710bb
2 changed files with 10 additions and 2 deletions
  1. 3 0
      CHANGES.txt
  2. 7 2
      src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java

+ 3 - 0
CHANGES.txt

@@ -273,6 +273,9 @@ BUGFIXES:
   ZOOKEEPER-1591. Windows build is broken because inttypes.h doesn't exist
   (Marshall McMullen via michim)
 
+  ZOOKEEPER-1596. Zab1_0Test should ensure that the file is closed
+  (Enis Soztutar via phunt)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

+ 7 - 2
src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java

@@ -1000,8 +1000,13 @@ public class Zab1_0Test {
         peer.setCnxnFactory(new NullServerCnxnFactory());
         File version2 = new File(tmpDir, "version-2");
         version2.mkdir();
-        new FileOutputStream(new File(version2, "currentEpoch")).write("0\n".getBytes());
-        new FileOutputStream(new File(version2, "acceptedEpoch")).write("0\n".getBytes());
+        FileOutputStream fos;
+        fos = new FileOutputStream(new File(version2, "currentEpoch"));
+        fos.write("0\n".getBytes());
+        fos.close();
+        fos = new FileOutputStream(new File(version2, "acceptedEpoch"));
+        fos.write("0\n".getBytes());
+        fos.close();
         return peer;
     }
 }