7023244: (zipfs) langtools CompileTest fails on read-only file system

Replaced checkAccess with Files.isWritable()

Reviewed-by: alanb
This commit is contained in:
Xueming Shen 2011-03-04 11:35:53 -08:00
parent a5c5bb811d
commit 2b73fac982

View File

@ -112,11 +112,8 @@ public class ZipFileSystem extends FileSystem {
}
// sm and existence check
zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.READ);
try {
zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.WRITE);
} catch (AccessDeniedException x) {
if (!Files.isWritable(zfpath))
this.readOnly = true;
}
this.zc = ZipCoder.get(nameEncoding);
this.defaultdir = new ZipPath(this, getBytes(defaultDir));
this.ch = Files.newByteChannel(zfpath, READ);