changeset 8571:42353b2e3064

7023244: (zipfs) langtools CompileTest fails on read-only file system Summary: replaced checkAccess with Files.isWritable() Reviewed-by: alanb
author sherman
date Fri, 04 Mar 2011 11:35:53 -0800
parents c9767adab3d2
children e3f785b9d3fb
files jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Fri Mar 04 09:32:20 2011 -0800
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Fri Mar 04 11:35:53 2011 -0800
@@ -112,11 +112,8 @@
         }
         // 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);