Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions test/jdk/jdk/nio/zipfs/TestPosix.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public class TestPosix {
// misc
private static final CopyOption[] COPY_ATTRIBUTES = {StandardCopyOption.COPY_ATTRIBUTES};
private static final Map<String, ZipFileEntryInfo> ENTRIES = new HashMap<>();
private static final boolean isWindows = System.getProperty("os.name") .startsWith("Windows");

private int entriesCreated;

Expand Down Expand Up @@ -292,7 +291,8 @@ private FileSystem createTestZipFile(Path zpath, Map<String, Object> env) throws
return fs;
}

private FileSystem createEmptyZipFile(Path zpath, Map<String, Object> env) throws IOException {
// The caller is responsible for closing the FileSystem returned by this method
private FileSystem createEmptyZipFileSystem(Path zpath, Map<String, Object> env) throws IOException {
if (Files.exists(zpath)) {
System.out.println("Deleting old " + zpath + "...");
Files.delete(zpath);
Expand Down Expand Up @@ -481,7 +481,7 @@ public void testPosix() throws IOException {
public void testCopy() throws IOException {
// copy zip to zip with default options
try (FileSystem zipIn = createTestZipFile(ZIP_FILE, ENV_DEFAULT);
FileSystem zipOut = createEmptyZipFile(ZIP_FILE_COPY, ENV_DEFAULT)) {
FileSystem zipOut = createEmptyZipFileSystem(ZIP_FILE_COPY, ENV_DEFAULT)) {
Path from = zipIn.getPath("/");
Files.walkFileTree(from, new CopyVisitor(from, zipOut.getPath("/")));
}
Expand Down Expand Up @@ -517,7 +517,7 @@ public void testUnzipDefault() throws IOException {

// the target zip file is opened with Posix support
// but we expect no permission data to be copied using the default copy method
try (FileSystem tgtZip = createEmptyZipFile(ZIP_FILE_COPY, ENV_POSIX)) {
try (FileSystem tgtZip = createEmptyZipFileSystem(ZIP_FILE_COPY, ENV_POSIX)) {
Files.walkFileTree(UNZIP_DIR, new CopyVisitor(UNZIP_DIR, tgtZip.getPath("/")));
}

Expand Down Expand Up @@ -560,7 +560,7 @@ public void testUnzipPosix() throws IOException {
// permissions should have been propagated to file system
checkEntries(UNZIP_DIR, checkExpects.permsPosix);

try (FileSystem tgtZip = createEmptyZipFile(ZIP_FILE_COPY, ENV_POSIX)) {
try (FileSystem tgtZip = createEmptyZipFileSystem(ZIP_FILE_COPY, ENV_POSIX)) {
// Make some files owner readable to be able to copy them into the zipfs
addOwnerRead(UNZIP_DIR);

Expand Down Expand Up @@ -742,13 +742,8 @@ public void setPermissionsShouldPreserveRemainingBits() throws IOException {
*/
@Test
public void setPermissionsShouldConvertToUnix() throws IOException {
// Temporarily skip test on Windows until intermittent failures are investigated
if(isWindows) {
return;
}
// The default environment creates MS-DOS entries, with zero 'external file attributes'
createEmptyZipFile(ZIP_FILE, ENV_DEFAULT);
try (FileSystem fs = FileSystems.newFileSystem(ZIP_FILE, ENV_DEFAULT)) {
try (FileSystem fs = createEmptyZipFileSystem(ZIP_FILE, ENV_DEFAULT)) {
Path path = fs.getPath("hello.txt");
Files.createFile(path);
}
Expand Down
1 change: 0 additions & 1 deletion test/jdk/jdk/nio/zipfs/test.policy.posix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ grant {
permission java.util.PropertyPermission "test.jdk","read";
permission java.util.PropertyPermission "test.src","read";
permission java.util.PropertyPermission "user.dir","read";
permission java.util.PropertyPermission "os.name","read";
permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.module";
permission java.lang.RuntimePermission "accessUserInformation";
};