@@ -104,7 +104,6 @@ public class TestPosix {
104104 // misc
105105 private static final CopyOption [] COPY_ATTRIBUTES = {StandardCopyOption .COPY_ATTRIBUTES };
106106 private static final Map <String , ZipFileEntryInfo > ENTRIES = new HashMap <>();
107- private static final boolean isWindows = System .getProperty ("os.name" ) .startsWith ("Windows" );
108107
109108 private int entriesCreated ;
110109
@@ -292,7 +291,8 @@ private FileSystem createTestZipFile(Path zpath, Map<String, Object> env) throws
292291 return fs ;
293292 }
294293
295- private FileSystem createEmptyZipFile (Path zpath , Map <String , Object > env ) throws IOException {
294+ // The caller is responsible for closing the FileSystem returned by this method
295+ private FileSystem createEmptyZipFileSystem (Path zpath , Map <String , Object > env ) throws IOException {
296296 if (Files .exists (zpath )) {
297297 System .out .println ("Deleting old " + zpath + "..." );
298298 Files .delete (zpath );
@@ -481,7 +481,7 @@ public void testPosix() throws IOException {
481481 public void testCopy () throws IOException {
482482 // copy zip to zip with default options
483483 try (FileSystem zipIn = createTestZipFile (ZIP_FILE , ENV_DEFAULT );
484- FileSystem zipOut = createEmptyZipFile (ZIP_FILE_COPY , ENV_DEFAULT )) {
484+ FileSystem zipOut = createEmptyZipFileSystem (ZIP_FILE_COPY , ENV_DEFAULT )) {
485485 Path from = zipIn .getPath ("/" );
486486 Files .walkFileTree (from , new CopyVisitor (from , zipOut .getPath ("/" )));
487487 }
@@ -517,7 +517,7 @@ public void testUnzipDefault() throws IOException {
517517
518518 // the target zip file is opened with Posix support
519519 // but we expect no permission data to be copied using the default copy method
520- try (FileSystem tgtZip = createEmptyZipFile (ZIP_FILE_COPY , ENV_POSIX )) {
520+ try (FileSystem tgtZip = createEmptyZipFileSystem (ZIP_FILE_COPY , ENV_POSIX )) {
521521 Files .walkFileTree (UNZIP_DIR , new CopyVisitor (UNZIP_DIR , tgtZip .getPath ("/" )));
522522 }
523523
@@ -560,7 +560,7 @@ public void testUnzipPosix() throws IOException {
560560 // permissions should have been propagated to file system
561561 checkEntries (UNZIP_DIR , checkExpects .permsPosix );
562562
563- try (FileSystem tgtZip = createEmptyZipFile (ZIP_FILE_COPY , ENV_POSIX )) {
563+ try (FileSystem tgtZip = createEmptyZipFileSystem (ZIP_FILE_COPY , ENV_POSIX )) {
564564 // Make some files owner readable to be able to copy them into the zipfs
565565 addOwnerRead (UNZIP_DIR );
566566
@@ -742,13 +742,8 @@ public void setPermissionsShouldPreserveRemainingBits() throws IOException {
742742 */
743743 @ Test
744744 public void setPermissionsShouldConvertToUnix () throws IOException {
745- // Temporarily skip test on Windows until intermittent failures are investigated
746- if (isWindows ) {
747- return ;
748- }
749745 // The default environment creates MS-DOS entries, with zero 'external file attributes'
750- createEmptyZipFile (ZIP_FILE , ENV_DEFAULT );
751- try (FileSystem fs = FileSystems .newFileSystem (ZIP_FILE , ENV_DEFAULT )) {
746+ try (FileSystem fs = createEmptyZipFileSystem (ZIP_FILE , ENV_DEFAULT )) {
752747 Path path = fs .getPath ("hello.txt" );
753748 Files .createFile (path );
754749 }
0 commit comments