--- old/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java 2019-03-20 17:23:07.119229600 +0100 +++ new/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java 2019-03-20 17:23:06.133499200 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.FileAttributeView; +import java.nio.file.attribute.PosixFileAttributes; import java.nio.file.spi.FileSystemProvider; import java.security.AccessController; import java.security.PrivilegedActionException; @@ -131,13 +132,13 @@ throws IOException { ensureFile(path); - try { - ZipFileSystem zipfs; - if (env.containsKey("multi-release")) { - zipfs = new JarFileSystem(this, path, env); - } else { - zipfs = new ZipFileSystem(this, path, env); - } + try { + ZipFileSystem zipfs; + if (env.containsKey("multi-release")) { + zipfs = new JarFileSystem(this, path, env); + } else { + zipfs = new ZipFileSystem(this, path, env); + } return zipfs; } catch (ZipException ze) { String pname = path.toString(); @@ -291,17 +292,31 @@ readAttributes(Path path, Class type, LinkOption... options) throws IOException { - if (type == BasicFileAttributes.class || type == ZipFileAttributes.class) + // unconditionally support BasicFileAttributes and ZipFileAttributes + if (type == BasicFileAttributes.class || + type == ZipFileAttributes.class) + { return (A)toZipPath(path).getAttributes(); - return null; + } + + // support PosixFileAttributes when activated + if (type == PosixFileAttributes.class) { + ZipPath zpath = toZipPath(path); + if (zpath.zfs.supportPosix) { + return (A)zpath.getAttributes(); + } + } + + throw new UnsupportedOperationException("Attributes of type " + + type.getName() + " not supported"); } @Override public Map - readAttributes(Path path, String attribute, LinkOption... options) + readAttributes(Path path, String attributes, LinkOption... options) throws IOException { - return toZipPath(path).readAttributes(attribute, options); + return toZipPath(path).readAttributes(attributes, options); } @Override