JDK 9 RFR of 8176237: (fs) java/nio/file/FileStore/Basic.java should conditionally check FileStores

Brian Burkhalter brian.burkhalter at oracle.com
Thu Mar 9 16:22:08 UTC 2017


On Mar 9, 2017, at 4:30 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:

>> Looks okay but FileUtils.areFileSystemsAccessible() needs a comment so that future users of this test infrastructure have something to read.
> 
> Also, FileUtils already has a field, `isWindows`, that can be used
> rather than re-reading the `os.name` system property.

OK I’ve made these two changes in

http://cr.openjdk.java.net/~bpb/8176237/webrev.01/

The difference with webrev.00 is included below.

Thanks,

Brian

--- a/test/lib/testlibrary/jdk/testlibrary/FileUtils.java
+++ b/test/lib/testlibrary/jdk/testlibrary/FileUtils.java
@@ -192,19 +192,27 @@
         return excs;
     }
 
+    /**
+     * Checks whether all file systems are accessible. This is performed
+     * by checking free disk space on all mounted file systems via a
+     * separate, spawned process. File systems are considered to be
+     * accessible if this process completes successfully before a given
+     * fixed duration has elapsed.
+     *
+     * @implNote On Unix this executes the {@code df} command in a separate
+     * process and on Windows always returns {@code true}.
+     */
     public static boolean areFileSystemsAccessible() throws IOException {
         boolean areFileSystemsAccessible = true;
-        if (!System.getProperty("os.name").equals("Windows")) {
+        if (!isWindows) {
             // try to check whether 'df' hangs
-            System.out.println("\n--- Begin df output ---");
+            System.out.println("\n--- df output ---");
             System.out.flush();
             Process proc = new ProcessBuilder("df").inheritIO().start();
             try {
                 proc.waitFor(90, TimeUnit.SECONDS);
             } catch (InterruptedException ignored) {
             }
-            System.out.println("--- End df output ---\n");
-            System.out.flush();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20170309/4d1dcee6/attachment.html>


More information about the nio-dev mailing list