JDK 9 RFR of 8157287: java/nio/file/FileStore/Basic.java failed with "java.nio.file.AccessDeniedException : /zones/zoneone/root "

Brian Burkhalter brian.burkhalter at oracle.com
Fri Jul 8 21:02:50 UTC 2016


Please review at your convenience.

Issue:	https://bugs.openjdk.java.net/browse/JDK-8157287

When testing whether space attributes are available, skip the store if an AccessDeniedException is encountered.

Thanks,

Brian

--- a/test/java/nio/file/FileStore/Basic.java
+++ b/test/java/nio/file/FileStore/Basic.java
@@ -114,21 +114,27 @@
         for (FileStore store: FileSystems.getDefault().getFileStores()) {
             System.out.format("%s (name=%s type=%s)\n", store, store.name(),
                 store.type());
 
             // check space attributes are accessible
             try {
                 store.getTotalSpace();
                 store.getUnallocatedSpace();
                 store.getUsableSpace();
             } catch (NoSuchFileException nsfe) {
                 // ignore exception as the store could have been
                 // deleted since the iterator was instantiated
                 System.err.format("%s was not found\n", store);
+            } catch (AccessDeniedException ade) {
+                // ignore exception as the lack of ability to access the
+                // store due to lack of file permission or similar does not
+                // reflect whether the space attributes would be accessible
+                // were access to be permitted
+                System.err.format("%s is inaccessible\n", store);
             }
 
             // two distinct FileStores should not be equal
             assertTrue(!store.equals(prev));
             prev = store;
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20160708/0dacbeea/attachment.html>


More information about the nio-dev mailing list